Hello everyone!
I have a unique modal for the whole project(based on one html page,with
page transitions via jQuery) and I append data in the body everytime I show
it. My problem is that when i close the modal and re-open it with new
content, javascript stops working and no modal is opened. If i add some
delay between closing and opening it works on some browsers but doesn't on
others(chrome for example) and the code is really ugly.
I think I should bind an event when the modal is closed before opening a
new one. Here's my code for opening a modal:
function apriModal(header, messaggio, callback, conferma) {
var re = new RegExp("</?\w+\s+[^>]*>");
$("#modalHeaderTitle").text(header);
if (messaggio.match(re)) {
$("#modalBodyText").html(messaggio);
}
else {
$("#modalBodyText").html("<p>" + messaggio + "</p>");
}
(!conferma) ? $("#modalConfirm").hide() : $("#modalConfirm").show();
$("#finestraModal").modal('show')
$("#modalConfirm").off().click(function () {
if (conferma) {
$("#finestraModal").modal('hide')
conferma();
}
});
$("#modalClose").show();
$("#modalClose").off().click(function () {
if (callback) {
callback();
}
$("#finestraModal").modal('hide');
});}
Here's a little example: http://jsfiddle.net/thetom/nqNzr/14/
If you need more info ask. Thank you so much in advance!
--
You received this message because you are subscribed to the Google Groups
"twitter-bootstrap" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.