window阻止冒泡事件

 <!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>
    <style>
        .publisher_TpAsB.border_NWmBE {
            border: 1px solid #d7d9e0;
        }
        
        .publisher_TpAsB {
            zoom: 1;
            background-color: #fff;
            display: flow-root;
            width: 900px;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
        }
        
        .publisher-wrap_x5sK8 .panel_LE9IL {
            position: relative;
        }
        
        .publisher-wrap_x5sK8 .textarea_SITY3 {
            background-color: transparent;
            border: none;
            border-bottom: 0 solid transparent;
            color: #333;
            display: block;
            font-size: 13px;
            height: 32px;
            line-height: 32px;
            margin: 0;
            outline: none;
            overflow-y: auto;
            padding: 0;
            position: relative;
            resize: none;
            transition: height .6s, margin-left .6s, border-bottom .6s;
        }
        
        .publisher-wrap_x5sK8 .opt_XgXqH {
            bottom: 0;
            height: 32px;
            left: 0;
            position: absolute;
            width: 100%;
        }
        
        .publisher-wrap_x5sK8 .opt-emoji_L2LHq {
            background-image: url(https://b.bdstatic.com/searchbox/icms/searchbox/img/xib-emoj-btn2.png);
            background-position: 50%;
            background-repeat: no-repeat;
            background-size: cover;
            cursor: pointer;
            float: left;
            height: 20px;
            margin-top: 6px;
            width: 20px;
        }
        
        .publisher-wrap_x5sK8 .opt-btn_fUCxn {
            background: #4e6ef2;
            border-radius: 8px;
            color: #fff;
            cursor: pointer;
            float: right;
            font-size: 14px;
            font-weight: 400;
            height: 32px;
            line-height: 32px;
            text-align: center;
            user-select: none;
            width: 80px;
        }
    </style>
</head>

<body>
    <div class="publisher_TpAsB border_NWmBE" style=" border-radius: 8px">
        <div class="publisher-wrap_x5sK8" style="margin:0;padding:8px 8px 8px 12px;background-color:#FAFAFC;border-radius:8px;">
            <div class="panel_LE9IL">
                <textarea class="textarea_SITY3" placeholder="看热搜,发弹幕~" style="width: 150px; height: 32px; line-height: 32px; margin-left: 28px; border-bottom-width: 0px;border: 1px solid red;"></textarea>
                <!-- <textarea class="textarea_SITY3" placeholder="看热搜,发弹幕~" style="width: 100%; height: 55px; line-height: 21px; margin-left: 0px; border-bottom-width: 40px;"></textarea> -->
                <div class="opt_XgXqH"><span class="opt-emoji_L2LHq"></span>
                    <div class="opt-btn_fUCxn ">发表</div>
                    <!--455-->
                    <!--456-->
                </div>
            </div>
        </div>
    </div>

    <script>
        window.addEventListener("click", function() {
            document.querySelector(".textarea_SITY3").style = "width: 100%; height: 55px; line-height: 21px; margin-left: 0px; border-bottom-width: 40px;";
        })
        document.querySelector(".textarea_SITY3").addEventListener("click", function(event) {
            window.event ? window.event.cancelBubble = true : event.stopPropagation();
            document.querySelector(".textarea_SITY3").style = "width: 150px; height: 32px; line-height: 32px; margin-left: 28px; border-bottom-width: 0px;";
        })
    </script>
</body>

</html>

window.event ? window.event.cancelBubble = true :
event.stopPropagation();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

你的美,让我痴迷

你的好,我会永远记住你的。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值