jQuery方式实现动画菜单

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="js/jquery-3.4.1.min.js"></script>
    <title>三级菜单</title>
    <script>

        $(function () {
            $(".top-nav li").mousemove(function () {
                $(this).children("ul").slideDown("1000");
            })
            $(".top-nav li").mouseleave(function () {
                $(this).children("ul").slideUp("slow");
            })
        });

    </script>
    <style>
        a {
            color: #FFFF99;
            text-decoration: none;
        }

        .top-nav {
            font-size: 16px;
            font-weight: bold;
            /* 去小圆点 */
            list-style: none;
        }

        .top-nav li {
            float: left;
            /* 每个菜单之间有1像素间距 */
            margin-right: 1px;
        }

        /* 二级菜单 */
        .top-nav li ul {
            display: none;
            /* 去圆点 */
            list-style: none;
            padding: 0px;
            position: absolute;
            float: left;

        }

        .top-nav li a {
            line-height: 34px;
            text-decoration: none;
            background: #DDDDDD;
            color: #666666;
            display: block;
            width: 80px;
            text-align: center;
        }

        .top-nav li a:hover {
            background: url("images/slide-bg.PNG") repeat-x;
        }

        .top-nav li:hover ul {
            display: block;

        }

        .note {
            display: block;
            color: #3f240e;
            background: url("images/slide-bg.PNG") repeat-x;
        }

        .corner {
            display: block;
            height: 18px;
            background: url("images/corner.PNG") 27px 0 no-repeat;

        }
    </style>
</head>

<body>
    <div id="top">
        <ul class="top-nav">
            <li><a href="#"><span class="note">首页</span></a></li>
            <li><a href="#">课程大厅</a></li>
            <li><a href="#">学习中心</a>
                <ul>
                    <span class="corner"></span>
                    <li><a href="#">前端课程</a></li>
                    <li><a href="#">后端课程</a></li>
                    <li><a href="#">移动开发</a></li>
                </ul>
            </li>
            <li><a href="#">经典案例</a></li>
            <li><a href="#">关于我们</a></li>
        </ul>
    </div>
</body>

</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值