Posted in Javascript onOctober 11, 2013
<div id="follow"> <a href="#" onmouseover="showPlusMobile();" onmouseout="hidePlusMobile();" class="btn">+Follow</a> <div class="layer_follow" id="layer_follow" onmouseover="showPlusMobile();" onmouseout="hidePlusMobile();"> <p>这是隐藏层</p> </div> </div>
css:
.layer_follow { display:none }
js:
var isPlusMobileVisible=false; var showTid; var hideTid; function showPlusMobile(){ if(isPlusMobileVisible == false) { showTid = setTimeout("document.getElementById('layer_follow').style.display='block'; isPlusMobileVisible=true;", 500); }else{ clearTimeout(hideTid); } } function hidePlusMobile(){ if(isPlusMobileVisible == true) { hideTid = setTimeout("document.getElementById('layer_follow').style.display='none'; isPlusMobileVisible=false;", 500); }else { clearTimeout(showTid); } }
鼠标划过实现延迟加载并隐藏层的js代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@