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 = '<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>'; $(document.body).append(HuiFang.m_tishi); } $("#app_tishi").show(); $(".app_tishi").html(content); if (url) { window.setTimeout("location.href='" + url + "'", 1500); } else { setTimeout('$("#app_tishi").fadeOut()', 1500); } }, }
Using:
HuiFang.Funtishi("请输入名字。");
As mentioned above This is the jQuery pop-up div layer introduced by the editor to automatically disappear after 2 seconds