B
B
b_kozyrev2016-05-30 14:58:34
JavaScript
b_kozyrev, 2016-05-30 14:58:34

Why does bootstrap popover stop working?

I'm making a book using turn.js.
Some sort of script conflict. There is a blue "i" icon, when clicked, a window with text appears (popover from bootstrap). But on the third and further page, the window stops appearing, and also, if you return to the second and first pages, then it stops working here too.
How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2016-05-30
@b_kozyrev

Popups are now initialized once on the page. And at the time of initialization, there are exactly two popups on the page (open the inspector in the browser, the console and execute $('[data-toggle="popover"]').length ).
You need to subscribe to the turn.js event. Perhaps the turned event will do ( www.turnjs.com/docs/Event:_turned ):

$(function() {
    $('.flipbook').turn({
        width: 1000,
        height: 349,
        elevation: 50,
        gradients: true,
        autoCenter: true
    });

    $(".flipbook").on("turned", function() {
        var $popovers = $('[data-toggle="popover"]');
        $popovers.popover("destroy");
        $popovers.popover();
    });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question