码迷,mamicode.com
首页 > Web开发 > 详细

jquery下拉菜单[复合事件hover制作]

时间:2017-06-05 15:41:28      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:class   blog   ati   bsp   20px   children   oat   char   asc   

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="js/jquery-1.7.2.min.js"></script>
    <title></title>
    <style type="text/css">
        .div1 {
            position: relative;
            width: 100px;
            height: 50px;
            background-color: red;
            float: left;
            margin-left: 20px;
        }

        .div2 {
            position: absolute;
            width: 100%;
            height: 0px;
            top: 50px;
            background-color: green;
        }
    </style>
</head>
<body>
    <div class="div1">
        <div class="div2"></div>
    </div>

    <div class="div1">
        <div class="div2"></div>
    </div>

    <div class="div1">
        <div class="div2"></div>
    </div>

    <div class="div1">
        <div class="div2"></div>
    </div>

    <div class="div1">
        <div class="div2"></div>
    </div>
</body>
</html>
<script type="text/javascript">
    $(".div1").hover(
        function () {
            var aaa = $(this).children(".div2:eq(0)");
            aaa.stop().animate({ height: "300px" }, 500)
        },
        function () {
            var aaa = $(this).children(".div2:eq(0)");
            aaa.stop().animate({ height: "0px" }, 500)
        }
        );
</script>

 

jquery下拉菜单[复合事件hover制作]

标签:class   blog   ati   bsp   20px   children   oat   char   asc   

原文地址:http://www.cnblogs.com/zhangxin4477/p/6944974.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!