How to connect a function for popover off event (Twitter Bootstrap)

I did a few searches, and I managed to figure out that I can attach events to buttons that make it close.

However, this does not apply when the user simply clicks elsewhere. I would like to trigger an event when the popover disappears and is deleted. Anyone have any suggestions?

Update: . I tried the answer below and could not get it to work, although this clearly follows from the jsfiddle example. There may be some conflicts with the libraries and settings that I use.

Here is the code I'm using:

this.$el
    .popover({ 
        html: true, 
        title: 'Schedule an appointment', 
        content: '<div id="' + this.popoverView.cid + '" class="event-popover"></div>', 
        placement: placement
    })
    .popover('show')
    .on('hidden', function(e) {
        alert('hidden');
    });

popover, , on hidden. . , (data-dismiss='modal') , .

, : require.js, backbone.js, marionette.js.

jsfiddle, , : http://jsfiddle.net/zj37u/

- , ? .

+5
1

hide hidden, popover. hide , popover , hidden - .

, popover:

HTML:

<a href="#" id="button"
        class="btn danger" 
        rel="popover" 
        data-original-title="title" 
        data-content="content">popover</a>

JS:

var $popover = $("a[rel=popover]").popover({
    trigger: "hover"
}).click(function(e) {
    e.preventDefault(); 
});

$popover.on("hidden", function(e) {
    alert("hidden");
});

jsfiddle: http://jsfiddle.net/Ny5Km/4/

Update:

bootstrap v3.3.5 . popover-events

$popover.on("hidden.bs.popover", function(e) {
    alert("hidden.bs.popover");
});
+10

All Articles