wutangl
wutangl

Reputation: 33

Bootstrap 3 Modal Shown Sometimes

I have strange behaviour with the modal dialog in Bootstrap 3.

I load data via AJAX and show the data within the dialog. Everythings seems to be ok. The dialog will be shown. I click on the link for showing the dialog. It works, but sometimes (perhaps after 5 times or after 20 times clicking the link) it doesn´t. The background becomes dark - but the modal does not appear. I checked it with firebug and the data came from the server, but the dialog will not show.

Do anyone have an idea what it could be?

Upvotes: 2

Views: 737

Answers (2)

Jay Haase
Jay Haase

Reputation: 1989

The bug has been fixed in Safari 7.1.

Upvotes: 0

Petercopter
Petercopter

Reputation: 1258

This is just a shot in the dark, but it's possible that the modal is not being reset correctly once it closes. When the modal closes, it still retains the content, and the data about it's state. This will clean out the data, and also remove the modal's content.

You could try this:

$('#my-modal').on('hidden.bs.modal', function( {
  $(this).removeData('bs.modal').children().remove();
});

Upvotes: 1

Related Questions