• js 原生写下拉框样式


    遇到一个问题,发现了一个很有用的却藏得很深的css属性:pointer-events

    遇到的问题:我希望让一个div浮在上面,但是鼠标事件作用于被覆盖的图层。

    解决方案:设置上面的div的css属性pointer-events为none

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <style>
        .selectBox {
        display: inline-block;
        position: relative;
        }
        .selectTips {
            /* position: absolute;
            height: 100%;
             85%;
            left: 1px;
            top: 0;
            text-align: left;
            line-height: 37px;
            background: white;
            border-bottom: 1px solid #e5e6e7;
            border-top: 1px solid #e5e6e7;
            pointer-events: none;
            padding-left: 15px; */
    
    
            font-size: 14px;
            border-top: 1px solid rgb(229, 230, 231);
            border-left: 1px solid rgb(229, 230, 231);
            border-bottom: 1px solid rgb(229, 230, 231);
             90%;
            height: 75%;
            margin-top: 3px;
            border-right-color: rgb(229, 230, 231);
            position: absolute;
            top: 0;
            background: white;
            pointer-events: none;
        }
    </style>
    <body>
        <div class="selectBox">
            <select name="BillState" id="BillState" class="search form-control">
                <option value="" selected disabled>请选择单据状态2</option>
                <option value="">所有单据</option>
                <option value="@((int)SaleOrderState.Invalid)" item-key="Invalid">草稿</option>
                <option value="@((int)SaleOrderState.ToDelive)" item-key="ToDelive">待出库</option>
                <option value="@((int)SaleOrderState.Deliving)" item-key="Deliving">部分出库</option>
                <option value="@((int)SaleOrderState.Delived)" item-key="Delived">已出库</option>
                <option value="@((int)SaleOrderState.ToSend)" item-key="ToSend">待发货</option>
                <option value="@((int)SaleOrderState.Send)" item-key="Send">已发货</option>
                <option value="@((int)SaleOrderState.ToRefund)" item-key="ToRefund">待退货</option>
                <option value="@((int)SaleOrderState.Refunding)" item-key="Refunding">@(BM.Util.EnumHelper.GetDescription(SaleOrderState.Refunding))</option>
                <option value="@((int)SaleOrderState.Refunded)" item-key="Refunded">已退货</option>
                <option value="@((int)SaleOrderState.Cancel)" item-key="Cancel">已取消</option>
                <option value="@((int)SaleOrderState.ToPay)" item-key="ToPay">待收款</option>
            </select>
            <div class="selectTips" id="BillStateText">
                请选择单据状态1
            </div>
        </div>
        
    </body>
    </html>
    <script src="./jquery-2.0.3.min.js"></script>
    <script>
        $(document).ready(function(){
            //选择事件
            $("#BillState").on("change", function () {
                var option_name = $(this).find("option:selected").text(),
                    item_name = option_name.replace(/(d+)s/, "");
                $("#BillStateText").text(item_name);
                $(this).blur();
            });
            //状态事件
            $("#BillState").on({
                focus: function() {
                    $("#BillStateText").css("border-color", "#1ab394");
                },
                blur: function () {
                    $("#BillStateText").css("border-color", "#e5e6e7");
                }
            });
    
        });
    
    </script>
    你所浪费的今天是那些死去的人所奢望的明天,你所厌恶的现在是未来的你所回不去的曾经。
  • 相关阅读:
    [转]Connecting To SQLite Database Using Node.js
    [转]Ubuntu安装ss客户端
    ubuntu18.04连接pptpd服务器(未成功)
    ubuntu18.04安装DB2 11.1 Express-c
    ubuntu 18.04使用sysbench测试MySQL性能
    ubuntu18.04手动安装二进制MySQL8.0
    ubuntu 18.04下载mysql8.0.13源码并编译安装(暂时没有成功)
    Linux使用sleep进行延迟实验
    『浅入浅出』MySQL 和 InnoDB
    『浅入深出』MySQL 中事务的实现
  • 原文地址:https://www.cnblogs.com/stj123/p/14416803.html
Copyright © 2020-2023  润新知