js鼠标感应,js达成鼠标感应向下滑动掩饰菜单的

作者: 计算机网络  发布:2019-09-06

正文实例陈述了js达成鼠标感应向下滑动遮绿叶甘蓝单的点子。分享给大家供大家参谋。具体落到实处格局如下:

js达成鼠标感应向下滑动隐蔽菜单的艺术,js鼠标感应

本文实例汇报了js落成鼠标感应向下滑动遮蔽菜单的法子。分享给大家供咱们参谋。具体完毕格局如下:

复制代码 代码如下:

<html>
<head>
<title>遮蔽在网页左上角感应鼠标向下滑出的隐敝菜单</title>
<style>#D1 {
    BACKGROUND-COLOR: blue;
    BORDER-BOTTOM: white 2px outset;
    BORDER-LEFT: white 2px outset;
    BORDER-RIGHT: white 2px outset;
    BORDER-TOP: white 2px outset;
    LEFT: 0px; POSITION: absolute;
    TOP: 0px; VISIBILITY: hidden;
    WIDTH: 300px;
    layer-background-color: lightgreen
}
a{font-size:9pt;color:#000000}
a:link{text-decoration:none}
a:hover{text-decoration:none;color:#FFFFFF}
a:visited{text-decoration:none}
.40pt{font-size:40pt;color:#ub39a1;font-family:文鼎琥珀繁}
</style>
<script language="javascript">
function menuIn() //菜单隐蔽
{
        if(n4) {
                clearTimeout(out_ID)
                if( menu.top > menuH*-1+20+10 ) { 
                        menu.top -= 8
                        in_ID = setTimeout("menuIn()", 1)
                }
                else if( menu.top > menuH*-1+20 ) {
                        menu.top--
                        in_ID = setTimeout("menuIn()", 1)
                }
        }
        else {
                clearTimeout(out_ID)
                if( menu.pixelTop > menuH*-1+20+10 ) {
                        menu.pixelTop -= 8
                        in_ID = setTimeout("menuIn()", 1)
                }
                else if( menu.pixelTop > menuH*-1+20 ) {
                        menu.pixelTop--
                        in_ID = setTimeout("menuIn()", 1)
                }
        }
}
function menuOut() //菜单显示
{
        if(n4) {
                clearTimeout(in_ID)
                if( menu.top < -10) {
                        menu.top += 4
                        out_ID = setTimeout("menuOut()", 1)
                }
                else if( menu.top < 0) {
                        menu.top++
                        out_ID = setTimeout("menuOut()", 1)
                }
               
        }
        else {
                clearTimeout(in_ID)
                if( menu.pixelTop < -10) {
                        menu.pixelTop += 2
                        out_ID = setTimeout("menuOut()", 1)
                }
                else if( menu.pixelTop < 0 ) {
                        menu.pixelTop++
                        out_ID = setTimeout("menuOut()", 1)
                }
        }
}
function fireOver() {
        clearTimeout(F_out)          
        F_over = setTimeout("menuOut()", 10)
}
function fireOut() {
        clearTimeout(F_over)
         F_out = setTimeout("menuIn()", 10)
}
function init() {
        if(n4) {
                menu = document.D1
                menuH = menu.document.height
                menu.top = menu.document.height*-1+20
                menu.onmouseover = menuOut
                menu.onmouseout = menuIn
        menu.visibility = "visible"
        }
        else if(e4) {
                menu = D1.style
                menuH = D1.offsetHeight
                D1.style.pixelTop = D1.offsetHeight*-1+20
                D1.onmouseover = fireOver
                D1.onmouseout = fireOut
                D1.style.visibility = "visible"
        }
}
F_over=F_out=in_ID=out_ID=null
n4 = (document.layers)?1:0
e4 = (document.all)?1:0;
</script>
</head>

<body onload="init()">

<div id="D1">

<table border="0" width="100%">
<TBODY>
  <tr>
    <td align="middle" bgColor="ub39a1" rowSpan="2"><b style="COLOR: ub39a1">
    M<br>
    E<br>
    N<br>
    U</b></td>
    <td> <br><br><ul>
      <li><a href="#nogo">
          选     项 1</a>
      </li>
      <li><a href="li#nogo">
          选     项 2</a>
      </li>
      <li><a href="#nogo">
          选     项 3</a>
      </li>
      <li><a href="#nogo">
          选     项 4</a>
      </li>
      <li><a href="#nogo">
          选     项 5</a>
      </li>
    </ul>
    </td>
    <td><br><br><ul>
      <li><a href="#nogo">
          选     项 6</a>
      </li>
      <li><a href="#nogo">
          选     项 7</a>
      </li>
      <li><a href="#nogo">
          选     项 8</a>
      </li>
      <li><a href="#nogo">
          选     项 9</a>
      </li>
      <li><a href="#nogo">
          选     项 10</a>
      </li>
    </ul>
    </td>
  </tr>
  <tr>
    <td align="right" colSpan="2">
     </td>
  </tr>
</TBODY>
</table>
</div>
</body>
</html>

仰望本文所述对大家的javascript程序设计具备帮助。

本文实例陈述了js完毕鼠标感应向下滑动遮绿叶甘蓝单的方法。分享给我们供大家参谋。具...

复制代码 代码如下:

<html>
<head>
<title>掩饰在网页左上角感应鼠标向下滑出的掩饰菜单</title>
<style>#D1 {
    BACKGROUND-COLOR: blue;
    BORDER-BOTTOM: white 2px outset;
    BORDER-LEFT: white 2px outset;
    BORDER-RIGHT: white 2px outset;
    BORDER-TOP: white 2px outset;
    LEFT: 0px; POSITION: absolute;
    TOP: 0px; VISIBILITY: hidden;
    WIDTH: 300px;
    layer-background-color: lightgreen
}
a{font-size:9pt;color:#000000}
a:link{text-decoration:none}
a:hover{text-decoration:none;color:#FFFFFF}
a:visited{text-decoration:none}
.40pt{font-size:40pt;color:#ub39a1;font-family:文鼎琥珀繁}
</style>
<script language="javascript">
function menuIn() //菜单遮蔽
{
        if(n4) {
                clearTimeout(out_ID)
                if( menu.top > menuH*-1+20+10 ) { 
                        menu.top -= 8
                        in_ID = setTimeout("menuIn()", 1)
                }
                else if( menu.top > menuH*-1+20 ) {
                        menu.top--
                        in_ID = setTimeout("menuIn()", 1)
                }
        }
        else {
                clearTimeout(out_ID)
                if( menu.pixelTop > menuH*-1+20+10 ) {
                        menu.pixelTop -= 8
                        in_ID = setTimeout("menuIn()", 1)
                }
                else if( menu.pixelTop > menuH*-1+20 ) {
                        menu.pixelTop--
                        in_ID = setTimeout("menuIn()", 1)
                }
        }
}
function menuOut() //菜单突显
{
        if(n4) {
                clearTimeout(in_ID)
                if( menu.top < -10) {
                        menu.top += 4
                        out_ID = setTimeout("menuOut()", 1)
                }
                else if( menu.top < 0) {
                        menu.top++
                        out_ID = setTimeout("menuOut()", 1)
                }
               
        }
        else {
                clearTimeout(in_ID)
                if( menu.pixelTop < -10) {
                        menu.pixelTop += 2
                        out_ID = setTimeout("menuOut()", 1)
                }
                else if( menu.pixelTop < 0 ) {
                        menu.pixelTop++
                        out_ID = setTimeout("menuOut()", 1)
                }
        }
}
function fireOver() {
        clearTimeout(F_out)          
        F_over = setTimeout("menuOut()", 10)
}
function fireOut() {
        clearTimeout(F_over)
         F_out = setTimeout("menuIn()", 10)
}
function init() {
        if(n4) {
                menu = document.D1
                menuH = menu.document.height
                menu.top = menu.document.height*-1+20
                menu.onmouseover = menuOut
                menu.onmouseout = menuIn
        menu.visibility = "visible"
        }
        else if(e4) {
                menu = D1.style
                menuH = D1.offsetHeight
                D1.style.pixelTop = D1.offsetHeight*-1+20
                D1.onmouseover = fireOver
                D1.onmouseout = fireOut
                D1.style.visibility = "visible"
        }
}
F_over=F_out=in_ID=out_ID=null
n4 = (document.layers)?1:0
e4 = (document.all)?1:0;
</script>
</head>

<body onload="init()">

<div id="D1">

<table border="0" width="100%">
<TBODY>
  <tr>
    <td align="middle" bgColor="ub39a1" rowSpan="2"><b style="COLOR: ub39a1">
    M<br>
    E<br>
    N<br>
    U</b></td>
    <td> <br><br><ul>
      <li><a href="#nogo">
          选     项 1</a>
      </li>
      <li><a href="li#nogo">
          选     项 2</a>
      </li>
      <li><a href="#nogo">
          选     项 3</a>
      </li>
      <li><a href="#nogo">
          选     项 4</a>
      </li>
      <li><a href="#nogo">
          选     项 5</a>
      </li>
    </ul>
    </td>
    <td><br><br><ul>
      <li><a href="#nogo">
          选     项 6</a>
      </li>
      <li><a href="#nogo">
          选     项 7</a>
      </li>
      <li><a href="#nogo">
          选     项 8</a>
      </li>
      <li><a href="#nogo">
          选     项 9</a>
      </li>
      <li><a href="#nogo">
          选     项 10</a>
      </li>
    </ul>
    </td>
  </tr>
  <tr>
    <td align="right" colSpan="2">
     </td>
  </tr>
</TBODY>
</table>
</div>
</body>
</html>

意在本文所述对大家的javascript程序设计有着帮忙。

您大概感兴趣的稿子:

  • Listloading.js移动端上拉下拉刷新组件
  • 基于JavaScript完毕鼠标向下滑动加载div的代码
  • js插件dropload上拉下滑加载数据实例深入分析
  • JS完结网页顶上部分向下滑出的全国城市切换导航功用
  • JS达成活动端判定上拉和降落功能

本文由今晚开什么码发布于计算机网络,转载请注明出处:js鼠标感应,js达成鼠标感应向下滑动掩饰菜单的

关键词: