一个弹窗效果满足:
1.初始化2s显示
2.显示要10s,隐藏要10s
3.显示的时候,点击关闭按钮,隐藏10s,然后在显示10s,如此循环。
利用jq
document.writeln(" <style>"); document.writeln(".chat_bottom{227px;height:148px;background:url(/images/0_fs_bottom01.png) no-repeat;position:fixed;bottom:-10px;right:-10px;cursor:pointer;z-index:9999999999;display:none}"); document.writeln(".chat_bottom a{display:block;227px;height:148px;}"); document.writeln(".chat_bottom span{position:absolute;right:10px;top:10px;20px;height:25px;display:block;cursor:pointer;}"); document.writeln(" </style>"); document.writeln("<div class="chat_bottom" id="chat_bottom"><a href="/chat.php"></a><span onclick="hideLovexin113()"></span></div>"); setTimeout("hide()",2000); function show(){ $("#chat_bottom").slideUp("slow"); s=setTimeout("hide()",10000); } function hide(){ $("#chat_bottom").slideDown("slow"); t=setTimeout("show()",10000); } function hideLovexin113(){ clearTimeout(t); clearTimeout(s); show(); }