Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show Bootstrap 3 popover when page is loaded and then hide

I have a question regarding to Bootstrap 3. I want to show popover, when the page is loaded -> when client opens certain html page, popover shows up and then after some time that popover fades out. What is the best way to do this? I am trying this where .poper is just a div's class around image

$(window).load(function(){
 $(".poper").popover('show');
    $(".poper").hide(600);
});

Thank You for Your replies.

like image 787
user859670 Avatar asked Jan 27 '26 13:01

user859670


1 Answers

If I get you right, you want to show the popover if the page if fully loaded, so the page is ready.

If so, a possible solution could be to set a timeout in the script, which calls the popover to close. This could look like this:

$().ready(function(){
    $('.poper').popover('show');
    window.setTimeout(function(){
        $('.poper').popover('hide');
    }, 600); //600 are the ms until the timeout is called
});

Explanation: The script show until the page is fully loaded the popover .poper and starts a timeout which will it closes it after 600ms.

like image 100
Jens L. Avatar answered Jan 29 '26 02:01

Jens L.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!