gpt4 book ai didi

javascript - 如何让 Colorbox 在页面加载后 5 秒显示?

转载 作者:行者123 更新时间:2023-11-30 10:54:26 26 4
gpt4 key购买 nike

这是我目前拥有的,但它正在立即加载:

<script type="text/javascript">
var pid = <?php echo $_GET['id']; ?>;
var rlink = "<?php echo $domain; ?>share.php?pid=" + pid;
$(document).ready(function(){
setTimeout($(".url_tag_small").colorbox({ href: rlink, width: "620px", height: "354px", opacity: 0.0, transition: "none", initialWidth: "620px", initialHeight: "354px", iframe: true, title: true, open: true}), 5000);
});
</script>

我做错了什么?

最佳答案

它在 setTimeout 调用初始化时执行您的回调,而不是在计时器关闭时执行。将其更改为:

var pid   = <?php echo $_GET['id']; ?>,
rlink = "<?php echo $domain; ?>share.php?pid=" + pid;

$(document).ready(function(){
setTimeout(function(){
$(".url_tag_small").colorbox({
href: rlink,
width: "620px",
height: "354px",
opacity: 0.0,
transition: "none",
initialWidth: "620px",
initialHeight: "354px",
iframe: true,
title: true,
open: true
})
}, 5000);
});

关于javascript - 如何让 Colorbox 在页面加载后 5 秒显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3015377/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com