1.效果

      jquery案例1-导航栏事件

 

 2.代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠标划入画出事件</title>
    <script src="jquery.js"></script>
    <style>
        * {
            padding:0px;
            margin:0px;
        }
        li {
            list-style: none;
        }
        a {
            text-decoration: none;
        }
        .show{
            margin:0 auto;
            width: 1200px;
        }
        .show .nav {
            float:left;
            margin-left:100px;
            background-color: pink;
            width: 100px;
            text-align: center;
        }
        .download {
            margin-top:10px;
        }
        .download li {
            margin-top:5px;
        }
        .download {
            display: none;
        }
    </style>
</head>
<body>
    <div class="show">
        <ul>
            <li class="nav"><a href="#">首页</a>
                <ul class="download">
                    <li>11111111</li>
                    <li>22222222</li>
                    <li>33333333</li>
                </ul>
            </li>
            <li class="nav"><a href="#">第一</a>
                <ul class="download">
                    <li>11111111</li>
                    <li>22222222</li>
                    <li>33333333</li>
                </ul>
            </li>
            <li class="nav"><a href="#">第二</a>
                <ul class="download">
                    <li>11111111</li>
                    <li>22222222</li>
                    <li>33333333</li>
                </ul>
            </li>
        </ul>
    </div>
</body>
</html>
<script>
    $(document).ready(function(){
        $(".nav").mouseover(function(){
            $(this).children(".download").show();
        });
        $(".nav").mouseout(function(){
            $(this).children(".download").hide();
        });
    });
</script>

 

相关文章:

  • 2021-07-31
  • 2022-12-23
  • 2021-09-11
  • 2022-03-06
  • 2021-11-05
  • 2021-08-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-10
  • 2021-11-29
  • 2021-06-14
  • 2022-12-23
  • 2021-11-29
相关资源
相似解决方案