资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
实用的层滑开js实现代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>实用的滑开层代码</title> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%3E%20%0D%0Avar%20flag%3D0%3B%20%0D%0Afunction%20f_s(id)%7B%20%0D%0Avar%20obj%3Ddocument.getElementById(id)%3B%20%0D%0Aobj.style.display%3D%22block%22%3B%20%0D%0Aobj.style.height%3D%221px%22%3B%20%0D%0Avar%20changeW%3Dfunction()%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0Avar%20obj_h%3DparseInt(obj.style.height)%3B%20%0D%0Aif(obj_h%3C%3D160)%7B%20%0D%0Aobj.style.height%3D(obj_h%2BMath.ceil((160-obj_h)%2F10))%2B%22px%22%3B%20%0D%0A%7D%20%0D%0Aelse%7B%20%0D%0AclearInterval(bw1)%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0Abw1%3D%20setInterval(changeW%2C1)%3B%20%0D%0A%20%20%20%20%20if(flag%3E0)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20clearInterval(bw2)%3B%20%0D%0A%20%20%20%20%20%7D%20%0D%0A%7D%20%0D%0Afunction%20closeW(id)%7B%20%0D%0A%20%20%20%20%20%20%20%20flag%2B%2B%3B%20%0D%0Avar%20obj%3Ddocument.getElementById(id)%3B%20%0D%0Avar%20closeDiv%3Dfunction()%7B%20%0D%0AclearInterval(bw1)%3B%20%0D%0Avar%20obj_h%3DparseInt(obj.style.height)%3B%20%0D%0Aif(obj_h%3E1)%7B%20%0D%0Aobj.style.height%3D(obj_h-Math.ceil(obj_h)%2F10)%2B%22px%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%7D%20%0D%0Aelse%7B%20%0D%0AclearInterval(bw2)%3B%20%0D%0Aobj.style.display%3D%22none%22%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0Abw2%3D%20setInterval(closeDiv%2C1)%3B%20%0D%0A%7D%20%0D%0Afunction%20showDiv()%7B%20%0D%0A%20%20%20%20var%20ele%20%3D%20document.getElementById(%22div1%22)%3B%20%0D%0A%20%20%20%20clearInterval(bw1)%3B%20%0D%0A%20%20%20%20clearInterval(bw2)%3B%20%0D%0A%20%20%20%20ele.style.display%20%3D%20%22block%22%3B%20%0D%0A%20%20%20%20ele.style.height%20%3D%20160%20%2B%20%22px%22%3B%20%20%20%20%20%0D%0A%7D%20%0D%0A%3C%2Fscript%3E"> <style type="text/css"> <!-- body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } .c {width:100%;height:30px;} .c ul {margin:0px;padding:0px;} .c ul li{width:100px;height:30px;float:left;background:#eeeeee;list-style-type:none} --> </style> </head> <body> <div class="c"> <ul> <li onmouseover="f_s('div1')" onmouseout="closeW('div1')">111</li> <li>222</li> <li>333</li> </ul> </div> <div id="div1" style="position:absolute;background:aqua;overflow:hidden;width:970px;display:none" onmouseover="showDiv()" onmouseout="closeW('div1')">000</div> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程