Home > Web Front-end > JS Tutorial > body text

JS CSS implements an alternative vertical navigation menu with prompt effect_javascript skills

WBOY
Release: 2016-05-16 15:36:30
Original
1242 people have browsed it

The example in this article describes the implementation of an alternative vertical navigation menu with prompt effect using JS CSS. Share it with everyone for your reference. The details are as follows:

This is a JS CSS to create an alternative vertical navigation menu with prompts. I think it is quite good, but the art level is limited. Friends who are interested, please continue to improve it.

The screenshot of the running effect is as follows:

The online demo address is as follows:

http://demo.jb51.net/js/2015/js-css-alert-txt-nav-menu-demo/

The specific code is as follows:

<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&#63; "ie" : typeof textcontainerobj.style.MozOpacity=="string"&#63; "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 id="coolmenu">
<a href="#" onMouseover="showtext('精品脚本代码下载!')" onMouseout="hidetext()">开始吧</a>
<a href="#" onMouseover="showtext('常用特效收集与发布')" onMouseout="hidetext()">网页特效</a>
<a href="#" onMouseover="showtext('网站地图索引')" onMouseout="hidetext()">资源分类</a>
<a href="#" onMouseover="showtext('最新更新的资源')" onMouseout="hidetext()">最新更新</a>
<a href="#" onMouseover="showtext('网站最热的下载')" onMouseout="hidetext()">下载排行</a>
<div id="tabledescription"></div>
</div>
</body>
</html>

Copy after login

I hope this article will be helpful to everyone’s JavaScript programming.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!