Home  >  Article  >  Web Front-end  >  jQuery implements secondary tab switching drop-down list effect with delay

jQuery implements secondary tab switching drop-down list effect with delay

高洛峰
高洛峰Original
2017-02-08 16:55:121029browse

本文实例讲述了jQuery implements secondary tab switching drop-down list effect with delay。分享给大家供大家参考。具体如下:

这是一款基于jQuery实现带延时效果的下拉列表菜单,有动画效果。

运行效果截图如下:

jQuery implements secondary tab switching drop-down list effect with delay

具体代码如下:

<!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=utf-8" />
<title>二级tab切换</title>
<style type="text/css">
 *{margin:0;padding:0;}
 body{padding:10px ;}
 #p1{background:#333;height:30px;width:400px;margin:0 0 10px 0;}
 #p1 li { width: 100px; float:left;line-height:30px; background: 333; margin:0 5px;list-style:none; text-align: center;}
 #p1 li a { color:#fff; text-decoration:none;font-size:12px; display:block;}
 #p1 li a:hover { text-decoration:underline;}
 #p1 li span { display: none;}
</style>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
</head>
<body>
 <p id="p1">
   <ul id="nav">
    <li>
    <a href="#">menu1</a>
    <span><a href="#">111</a></span>
    </li>
    <li>
    <a href="#">menu2</a>
    <span><a href="#">222</a></span>
    </li>
    <li>
    <a href="#">menu3</a>
    <span><a href="#">CopyRight@</a></span>
    </li>
    </ul>
  </p>
</body>
<script type="text/javascript">
 $(document).ready(function() { 
 $("ul#nav li").hover(function() { //Hover over event on list item
 $(this).find("span").show(200).css({ &#39;background&#39; : &#39;#1376c9&#39;,&#39;display&#39; : &#39;block&#39;}); //Show the subnav
 } , function() { //on hover out...
 $(this).find("span").hide(200); //Hide the subnav
 });
 });
</script>
</html>

更多jQuery implements secondary tab switching drop-down list effect with delay相关文章请关注PHP中文网!


Statement:
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