Home >Web Front-end >JS Tutorial >Mouse over the js code that implements lazy loading and hides the layer_javascript skills

Mouse over the js code that implements lazy loading and hides the layer_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:20:201207browse
Copy code The code is as follows:


< a href="#" onmouseover="showPlusMobile();" onmouseout="hidePlusMobile();" class="btn"> Follow

This is the hidden layer





css:
Copy code The code is as follows:

. layer_follow
{
display:none
}

js:
Copy code The code is as follows:

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);
}
}
Statement:
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