jquery定时弹出广告

HTML:

<div class="wrapper">
<div class="pop-up">
</div>

</div>


css:

.wrapper{
width: 100%;
height: 100%;
position: fixed;
background: #000;
opacity: 0.5;
top:0;
left: 0;
}
.pop-up{
width: 200px;
height: 200px;
background: #fff;
position: absolute;
top:50%;
left: 50%;
margin-top:-100px;
margin-left:-100px;
display: none;

}

js:

$(function(){
setTimeout(showpop,2000);
})
function showpop(){
$('.pop-up').slideDown(2000);
setTimeout(hidepop,2000)
}
function hidepop(){
$('.pop-up').slideUp(2000);
}

猜你喜欢

转载自blog.csdn.net/qq_37957273/article/details/79462111
今日推荐