简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM