码迷,mamicode.com
首页 > 其他好文 > 详细

jq 下拉框

时间:2019-06-21 13:03:07      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:scrollbar   coin   zid   float   add   block   color   lin   round   

    <div class="alls">
            <div class="item">
                <div class="all">
                    <span class="alla">选择</span>
                    <span>
                        <div class="coinbig-c2c-sanj"></div>                        
                    </span>
                </div>

                <div class="son">
                    <div class="son-input">
                        <img class="imgst" src="img/Group-2-copy.svg">
                        <input class="leftop" type="text">
                    </div>
                    <div class="son1">
                        <div class="as">00000000</div>
                        <div class="as">11111111</div>
                        <div class="as">22222222</div>
                        <div class="as">33333333</div>
                        <div class="as">44444444</div>
                        <div class="as">55555555</div>
                        <div class="as">66666666</div>
                    </div>
                </div>
            </div>

        </div>
<script>
            if($(‘.all‘).length > 0) {
                $(‘.all‘).on(‘click‘, function(e) {
                    var isShow = $(this).parents(‘.item‘).find(‘.son‘).is(‘:hidden‘);
                    isShow ? $(this).parents(‘.item‘).find(‘.son‘).slideDown(300) : $(this).parents(‘.item‘).find(‘.son‘).slideUp(300);
                    e.preventDefault();
                    e.stopPropagation();
                });
            }
            if($(‘.as‘).length > 0) {
                $(‘.as‘).on(‘click‘, function() {
                    $(this).parents(‘.item‘).find(‘.alla‘).text($(this).text());
                    $(‘.son‘).slideUp(300);
                });
            }
            $(".leftop").on(‘click‘, function(e) {
                e.preventDefault();
                e.stopPropagation();
            })
            $(".imgst").on(‘click‘, function(e) {
                e.preventDefault();
                e.stopPropagation();
            })
        </script>
    .all {
                width: 100%;
                height: 46px;
                display: block;
                position: relative;
                color: rgba(255,255,255,1);
            }
            
    
            
            .item {
                width: 100%;
                height: 100%;
                background: #2b4071;
                line-height: 48px;
                border-left: 1px solid #2a404f;
                cursor: pointer;
                border: 1px solid #2f4a64;
                border-radius: 3px;
            }
            
            .alla {
                margin-left: 10px;
                font-size: 18px;
                position: relative;
                font-size: 14px;
            }
            
            .as {
                padding-left: 10px;
                font-size: 14px;
            }
            
            .as:hover {
                background: #495689;
            }
            
            .son {
                width: 100%;
                display: none;
                background-color: #15284c;
                position: absolute;
                top: 48px;
                z-index: 1;
            }
            
            .item {
                position: relative;
            }
            
            .coinbig-c2c-sanj {
                width: 0;
                height: 0;
                border-width: 7px;
                border-style: solid;
                border-color: #ffffff transparent transparent transparent;
                background: #2b4071;
                position: absolute;
                right: 9px;
                top: 20px;
            }
            
    
            
            .zida {
                font-size: 18px;
            }
            
            
            
            .sonall {
                width: 100%;
                top: 48px;
            }
            
        
            
            .imgst {
                float: right;
                width: 16px;
                height: 16px;
                margin-top: 12px;
                margin-right: 10px;
            }
            
            .leftop {
                float: left;
                width: 80%;
                height: 100%;
                border: none;
            
                background: #15284c;
                color: #FFFFFF;
                padding-left: 10px;
                box-sizing: border-box;
            }
            
            .son-input {
                width: 90%;
                height: 40px;
                border: 1px solid #495d9a;
                margin: 10px auto;
            }
            
            .son1 {    
                overflow-y: auto;
                max-height: 192px;
                color: #EEEFF7;
            }
            
            .son1::-webkit-scrollbar {
                width: 3px;
                height: 0px;
            }
        
            .son1::-webkit-scrollbar-button {
                background-color: #15284c;
            }    
            .son1::-webkit-scrollbar-track {
                background: #15284c;
            }
            
            .son1::-webkit-scrollbar-thumb {
                background: #2a404f;
                border-radius: 10px;
            }
            
            .son1::-webkit-scrollbar-corner {
                background: #2a404f;
            }            
            .alls {
                width: 300px;
            }

 

jq 下拉框

标签:scrollbar   coin   zid   float   add   block   color   lin   round   

原文地址:https://www.cnblogs.com/chen527/p/11063617.html

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