Home > Web Front-end > JS Tutorial > jQuery pop-up div layer automatically disappears after 2 seconds

jQuery pop-up div layer automatically disappears after 2 seconds

高洛峰
Release: 2016-12-03 14:40:16
Original
2001 people have browsed it

Let me share with you a piece of code about the implementation code of jquery popping up the div layer and automatically disappearing. Without further ado, the specific code is as follows:

var HuiFang={
m_tishi :null,//全局变量 判断是否存在div,
//提示div 等待2秒自动关闭
Funtishi: function (content, url) {
if (HuiFang.m_tishi == null) {
HuiFang.m_tishi = &#39;<div class="xiaoxikuang none" id="app_tishi" style="z-index:9999;left: 15%;width:70%;position: fixed;background:none;bottom:10%;"> <p class="app_tishi" style="background: none repeat scroll 0 0 #000; border-radius: 30px;color: #fff; margin: 0 auto;padding: 1.5em;text-align: center;width: 70%;opacity: 0.8; font-family:Microsoft YaHei;letter-spacing: 1px;font-size: 1.5em;"></p></div>&#39;;
$(document.body).append(HuiFang.m_tishi);
}
$("#app_tishi").show();
$(".app_tishi").html(content);
if (url) {
window.setTimeout("location.href=&#39;" + url + "&#39;", 1500);
} else {
setTimeout(&#39;$("#app_tishi").fadeOut()&#39;, 1500);
}
},
}
Copy after login

Using:

   
HuiFang.Funtishi("请输入名字。");
Copy after login

As mentioned above This is the jQuery pop-up div layer introduced by the editor to automatically disappear after 2 seconds


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template