bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Modal animates only on the first hide()

Open adetwiler opened this issue 15 years ago • 4 comments

When hiding the modal using

<input id="close" class="btn" type="button" value="Close" onclick="$('#modal').modal('hide');" />

The modal hides with animation, but after showing the modal again:

        $('#modal').modal('show');
    }

the modal does not hide with animation. The hide animation always works when pressing escape.

adetwiler avatar Oct 28 '11 07:10 adetwiler

hm... can you create a jsfiddle demonstrating this problem? thanks!

fat avatar Oct 28 '11 17:10 fat

Hi fat,

This is similar code that I use.

http://jsfiddle.net/cm3gx/

It appears to be working on jsfildde, but I will try to further explain what happens on my end.

I am using the latest bootstrap-modal.js and the latest bootstrap css.

When clicking 'Close' I am experiencing the class 'in' gets removed and display: none; is set at the exact same time from the modal div. (Causing the animation not to occur)

But when I hit ESC, 'in' is removed first (Showing the animation), then display: none; is set after the animation occurs. On the modal div.

adetwiler avatar Oct 28 '11 18:10 adetwiler

hm... well it seems like the problem isn't related to boostrap if it's working in jsfiddle but not in you dev environment... could you reopen with a breaking example - thanks!

fat avatar Oct 28 '11 18:10 fat

I've been experiencing the same bug, and have narrowed it down to Prototype.js. If Prototype is loaded on the page, then the modal does not animate when dismissing.

I think this is more of an issue with Prototype being "helpful" than an error in Bootstrap though.

Example: http://jsfiddle.net/lachlan/4ySsc/

LachlanArthur avatar Sep 11 '12 01:09 LachlanArthur