gpt4 book ai didi

jquery - 置顶消息如何在 10 秒后自动关闭

转载 作者:太空宇宙 更新时间:2023-11-04 04:54:49 24 4
gpt4 key购买 nike

好吧,我知道如何显示可关闭的粘滞消息,但我想知道如何在 10 秒后关闭它,并显示 10 秒计数器...以及如何赋予它悬停效果...这是我的可关闭置顶信息,仅供您引用

<script>
function closeBox(toClose) {
document.getElementById(toClose).style.display = "none";setCookie(toClose,closed", 20);}

function setCookie(cName, value, expiredays) {var expDate = new Date();expDate.setDate(expDate.getDate()+expiredays);document.cookie=cName + "=" + escape(value) + ";expires=" + expDate.toGMTString();}

function loadMsg(msgClass) {msg = document.getElementsByTagName("div");for (i=0; i<msg.length; i++){if(msg[i].className == msgClass) {if(document.cookie.indexOf(msg[i].id) == -1) {msg[i].style.display = "block";}}}}

window.onload=function(){loadMsg('msgbox'); }
</script>

http://kownleg.blogspot.com
<style>
div.guestwarn {
background:#000000;
color:#FFFFFF;
max-width:280px;min-height:18px;padding:0 5px 3px;position:fixed;right: 2%;
top: 50%;padding: 10px 15px;position: fixed;z-index: 10;font-size:12px;-moz-border-radius: 8px; -webkit-border-radius: 8px; filter:alpha(opacity=88);
-moz-opacity:.88; opacity:.88; -moz-box-shadow:5px 5px 5px #191919; -webkit-box-shadow:5px 5px 5px #191919; box-shadow:5px 5px 5px #191919;
}
.close {float: right;background: transparent url(http://1.bp.blogspot.com/-hMdL9UJje_c/UA7nJADBTSI/AAAAAAAAABU/S5zftNPRxfs/s1600/close.png);width: 22px;height: 22px;}
</style>


<div id="message-1" class="msgbox" style="display: none;">
<div class="guestwarn"><a href="#" class="close" onclick="closeBox('message-1'); return false;" title=""></a>
**My Sticky Text Is Here**
</div>
</div>

最佳答案

已经有很多为此构建的插件,我更喜欢Purr ,我知道的另一个是 jQuery Growl .

关于jquery - 置顶消息如何在 10 秒后自动关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12678192/

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