我有一个带有cookie的弹出窗口,显示页面加载。但是我希望在页面加载后将.show更改为.slideUp,延迟时间为3秒。
这是我的代码:
<script>
$(document).ready(function(){
// function to show our popups
function showPopup(whichpopup){
if (document.cookie.replace(/(?:(?:^|.*;\s*)doSomethingOnlyOnce\s*\=\s*([^;]*).*$)|^.*$/, "$1") !== "true") {
$('.overlay-content').slideUp( 300 ).delay( 800 );
//display your popup background and set height to the page height
document.cookie = "doSomethingOnlyOnce=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
console.log("cookie not found.");
}
}
// function to close our popups
function closePopup(){
$('.overlay-content').hide(); //hide the overlay
}
// hide popup when user clicks on close button
$('.close-btn-new').click(function(){
closePopup();
});
showPopup(null);
});
</script>
答案 0 :(得分:0)
我会说:
window.setTimeout(function() {
$('.overlay-bg-lookbook').slideDown();
}, 3000);
slideUp用于隐藏。