如何在加载页面然后隐藏页面时显示 Bootstrap 3 弹出框

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

本文关键字:Bootstrap 显示 隐藏 加载 然后      更新时间:2023-09-26

我有一个关于 Bootstrap 3 的问题。我想显示弹出框,当页面加载时 ->当客户端打开某个 html 页面时,弹出框会显示,然后在一段时间后弹出窗口淡出。最好的方法是什么?我正在尝试这个.poper只是围绕图像的div类

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

感谢您的回复。

如果我

没猜错,您希望在页面完全加载时显示弹出框,因此页面已准备就绪。

如果是这样,一个可能的解决方案是在脚本中设置超时,这将调用弹出框关闭。这可能看起来像这样:

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

说明:脚本显示,直到页面完全加载弹出框.poper并启动超时,该超时将在 600 毫秒后关闭它。