第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請教關(guān)于jquery阻止冒泡的問題

請教關(guān)于jquery阻止冒泡的問題

繁華開滿天機(jī) 2018-10-16 13:15:43
如圖,我有一個彈窗想點(diǎn)擊除輪播區(qū)域外的地方關(guān)閉彈窗,點(diǎn)擊切換按鈕實(shí)現(xiàn)切換圖片代碼如下$('.cut-model').bind('click',function(e){       $(this).hide();//點(diǎn)擊空白區(qū)域關(guān)閉彈窗})$('.round').bind('click',function(e){    e.stopPropagation();//點(diǎn)擊切換按鈕阻止冒泡})然而。。。。并沒有成功,點(diǎn)擊切換按鈕時彈窗仍然關(guān)閉,請教各位大神是什么原因,我寫的不對嗎?謝謝
查看完整描述

1 回答

?
汪汪一只貓

TA貢獻(xiàn)1898條經(jīng)驗(yàn) 獲得超8個贊

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Title</title>


    <script type="text/javascript" src="jquery.min.js"></script>

    <style>

        .over-lay{

            width: 300px;

            height: 300px;

            position: absolute;

            left:50px;

            top:50px;

            background-color: rgba(235,235,235,0.5);

        }


        .over-lay.hide{

            display: none;

        }


        .content{

            background-color: green;

            width: calc(100% - 60px);

            height: calc(100% - 0px);

            border-radius: 10px;

            position: absolute;

            left: 30px;

            top: 0px;

        }

        .back-button,.forward-button{

            width: 30px;

            height: 30px;

            position: absolute;

            top:calc(50% - 15px);

            left:0px;

            background-color: red;

            font-size: 12px;

        }

        .forward-button{

            right:0px;

            left:auto;

        }

    </style>

    <script>

        $(function(){

            $(".over-lay").on("click",".back-button,.forward-button",function(event){

               console.log("不關(guān)閉overlay");

                event.stopPropagation();//阻止冒泡到.over-lay

            });

            $(".over-lay").on("click",function(event){

                console.log("關(guān)閉overlay");

                $(this).addClass("hide");

            });


        });

    </script>

</head>

<body>


<div class="over-lay">

    <div  class="back-button">后退</div>

    <div class="content"></div>

    <div  class="forward-button">前進(jìn)</div>

</div>


</body>

</html>


查看完整回答
反對 回復(fù) 2018-11-22
  • 1 回答
  • 0 關(guān)注
  • 534 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號