当用户鼠标点击链接后图层逐渐展开显示,点击关闭按钮逐渐隐藏起来,漂亮js图层伸缩展示特效,结合自己的需求来修改。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>js控制图层伸缩展开收缩效果_武鸣人</title> <style type="text/css"> #show{ display:none; margin:0px auto; background-color:#FF0000; } #txt{ width:760px; height:30px; margin:0px auto; background-color:#efefef; } </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div id=show> </div> <div id=txt> <a href="#" onClick="show()">Open</a> <a href="#" onClick="show2()">Close</a> </div> <script type="text/javascript"> function show(){ if (!document.getElementById) return false; if (!document.getElementById("show")) return false; var show = document.getElementById("show"); show.style.width = "0px"; show.style.height = "0px"; show.style.display = "block"; movement = setTimeout("animation()",0) }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function animation(){ if (!document.getElementById) return false; if (!document.getElementById("show")) return false; var show = document.getElementById("show"); var xpos = parseInt(show.style.width); var ypos = parseInt(show.style.height); if (xpos == 760 && ypos == 420){ return true; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) if (xpos < 760){ xpos++; } if (xpos > 760){ xpos--; } if (ypos < 420){ ypos++; } if (ypos > 420){ ypos--; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) show.style.width = xpos + "px"; show.style.height = ypos + "px"; movement = setTimeout("animation()",0); } function show2(){ if (!document.getElementById) return false; if (!document.getElementById("show")) return false; var show = document.getElementById("show"); show.style.width = "760px"; show.style.height = "420px"; show.style.display = "block"; movement = setTimeout("animation2()",0) } function animation2(){ if (!document.getElementById) return false; if (!document.getElementById("show")) return false; var show = document.getElementById("show"); var xpos = parseInt(show.style.width); var ypos = parseInt(show.style.height); if (xpos == 0 && ypos == 0){ return true; } if (xpos < 0){ xpos++; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) if (xpos > 0){ xpos--; } if (ypos < 0){ ypos++; } if (ypos > 0){ ypos--; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) show.style.width = xpos + "px"; show.style.height = ypos + "px"; movement = setTimeout("animation2()",0); } </script> </body> </html>
本文来自武鸣人网站,转载请注明出处