龙空技术网

利用jQuery实现窗口右下角弹出消息框

Cyan4399 78

前言:

眼前同学们对“jquery弹出框页面”都比较讲究,你们都想要剖析一些“jquery弹出框页面”的相关内容。那么小编也在网络上搜集了一些关于“jquery弹出框页面””的相关知识,希望你们能喜欢,咱们一起来学习一下吧!

其核心是setTimeout()函数功能,实现反复弹出。

1、当网页打开时效果

当网页打开时情况下

2、点击关闭后,黑色阴影部分消失,但是在2秒后又会在右下角出现。

jQuery核心代码:

$(document).ready(function() {

var k = $("#k");

$("#k").css("bottom", "0");

$("#k a").click(function() {

$("#k").css("bottom", "-200px");

setTimeout(function() {

$("#k").css("bottom", "0")

}, 2000);

});

});

HTML代码:

<div id="k">

<a>关闭</a>

</div>

CSS代码:

* {

margin: 0;

padding: 0

}

#k {

width: 200px;

height: 200px;

position: fixed;

right: 30px;

bottom: -200px;

background-color:#666;

transition: all 2s;

}

#k a {

float: right;

padding: 5px 10px;

border: 1px solid black;

cursor: pointer;

}

标签: #jquery弹出框页面