关于JQuery中的下拉框

在复习与学习的同时,随着知识的混学,很容易就把一些知识忘记,因此我将内容分享在CSDN平台中,供大家参考,并且为自己日后复习做存储。

<!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8">
        <title>jquery实现的下拉菜单</title>
        <style type="text/css">
            *{
                padding:0;
                margin:0;
            }
            .box {
                margin: 0px 30px ;
                width: 120px;
                background-color: rgb(128, 125, 125);
                position: relative;
                height: 26px;
                text-align-last: center;
            }
             .box .item {
                position: absolute;
                display:none;
                left: 0px;
                top: 26px;
                background-color: rgb(175, 180, 184);
                width: 100%;
            }
 
            .box .item a {
                text-decoration: none;
                color: #33393e;
            } 
        </style>
    <script src="./js/jquery-1.11.3.js"></script>
        <script>
            $(function(){
                $('box').click(function(e){
                    $(this).find('.item').toggle();
                });
                $('.box').click(function(e){
                    $(this).find('.item').toggle();
                });
            });
        </script>
    </head>
 
    <body>
        <div class="box">
            <span type="button">按钮</span>
            <dl class="item">
                <dd><a href="">选项1</a></dd>
                <dd><a href="">选项2</a></dd>
                <dd><a href="">选项3</a></dd>
            </dl>
        </div>
    </body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值