twitter/bootstrap — Issue #2355: Modal dialogs: Binding show code on first click causes animation to be skipped on first launch.
Author: godfreykfc
Created: 2012-03-01 13:07:11+00:00
State: open

I haven't dug too deep into this, but it appears that the code that displays a modal dialog is being bind to the data-toggle="modal" button when they are first being clicked. There seems to be a non-trivial setup cost involved here (finding the dialog div in the DOM, creating the backdrop, etc), which causes most of the "drop in" animation to be skipped on the first launch. Dismissing the dialog and brining it up again with the button shows no such problem. This is quite unfortunately because I liked the animation, but most modal dialogs are only being shown once per page. It would be nice if there is a way for me to hand pick the "important" dialogs (such as forms) and pay the setup cost on page load, so that when the user clicks on the button the animation will be smooth as butter.