JS+CSS实现另类带提示效果的竖向导航菜单

这篇文章主要介绍了JS+CSS实现另类带提示效果的竖向导航菜单,可实现鼠标滑过菜单项在下方固定区域显示对应提示文字的效果,涉及鼠标事件控制页面元素样式的相关技巧,需要的朋友可以参考下

本文实例讲述了JS+CSS实现另类带提示效果的竖向导航菜单。分享给大家供大家参考。具体如下:

这是一款JS+CSS打造另类带提示的竖向导航菜单,觉得挺不错,只是美工水平有限,有兴趣的朋友就请继续完善吧。

运行效果截图如下:

JS+CSS实现另类带提示效果的竖向导航菜单

在线演示地址如下:

具体代码如下:

<html> <head> <title>带提示的竖向导航菜单</title> <style type="text/css"> #coolmenu{ border: 1px solid black; width: 160px; background-color: #E6E6E6; } #coolmenu a{ font: bold 13px Verdana; padding: 2px; padding-left: 4px; display: block; width: 100%; color: black; text-decoration: none; border-bottom: 1px solid black; } html>body #coolmenu a{ width: auto; } #coolmenu a:hover{ background-color: black; color: white; } #tabledescription{ width: 100%; height: 3em; padding: 2px; filter:alpha(opacity=0); -moz-opacity:0; } </style> <script type="text/javascript"> var baseopacity=0 function showtext(thetext){ if (!document.getElementById) return textcontainerobj=document.getElementById("tabledescription") browserdetect=textcontainerobj.filters? "ie" : typeof textcontainerobj.style.MozOpacity=="string"? "mozilla" : "" instantset(baseopacity) document.getElementById("tabledescription").innerHTML=thetext highlighting=setInterval("gradualfade(textcontainerobj)",50) } function hidetext(){ cleartimer() instantset(baseopacity) } function instantset(degree){ if (browserdetect=="mozilla") textcontainerobj.style.MozOpacity=degree/100 else if (browserdetect=="ie") textcontainerobj.filters.alpha.opacity=degree else if (document.getElementById && baseopacity==0) document.getElementById("tabledescription").innerHTML="" } function cleartimer(){ if (window.highlighting) clearInterval(highlighting) } function gradualfade(cur2){ if (browserdetect=="mozilla" && cur2.style.MozOpacity<1) cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.2, 0.99) else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100) cur2.filters.alpha.opacity+=20 else if (window.highlighting) clearInterval(highlighting) } </script> </head> <body> <div> <a href="#">开始吧</a> <a href="#">网页特效</a> <a href="#">资源分类</a> <a href="#">最新更新</a> <a href="#">下载排行</a> <div></div> </div> </body> </html>

希望本文所述对大家的JavaScript程序设计有所帮助。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wggydj.html