twitter bootstrap - How to close popovers on modal close? -


i want close popovers in modal, not displayed if reopen modal.

the problem if try close @ $("#modal").on("hidden", function() { [...] });, targets unavailable. same goes if @ .on("shown", ....

i cannot delete using :

$(".buttonpopover").popover("hide"); 

because .buttonpopover never available @ time want delete popovers. how can close them without accessing parent ?

bootply

the problem if try close @ .on("hidden"), targets unavailable

that's because hidden.bs.modal event fires:

"when modal has finished being hidden user (will wait css transitions complete)."

instead, use hide.bs.modal event which:

" fired when hide instance method has been called"

like this:

$('.modal').on('hide.bs.modal', function() {   $("#openpopover").popover("hide") }); 

demo in bootply


update

i'm curious if you're hidden event firing in first place. event name namespaced have refer hidden.bs.modal

this never called:

$('.modal').on('hidden', function() {   alert('hi'); }); 

this should work:

$('.modal').on('hidden.bs.modal', function() {   $("#openpopover").popover("hide") }); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -