我有一个弹出组用一个cookie,显示在页面加载。不过,我希望在加载页面后将.show更改为.slideUp,延迟时间为3秒。jQuery的 - 改变.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>
这样的事情? https://plnkr.co/edit/u7ZkivQNId8uT5h0ADQ0?p=preview如果你想在页面底部的弹出式窗口,只将它移出div容器 – Rinrub
的我已经试过以上,但没有成功。任何指针将不胜感激。请参阅我的代码编辑。 – user3767554