Multiple siblings, how can only one be displayed when clicked, and not all of them can be clicked?

<div>
<a class="hight-light lever" data-item="Lever" data-name="UL3" style="left:26%;top:45%;"></a>
            <a class="hight-light lever" data-item="Lever" data-name="UL3" style="left:35%;top:54%;"></a>
            <a class="hight-light lever" data-item="Lever" data-name="UL1" style="left:58%;top:46%;"></a>
            <a class="hight-light lever" data-item="Lever" data-name="UL1" style="left:26%;top:76%;"></a>
            <a class="hight-light deadbolt" data-item="Deadbolt" data-name="UBOLT" style="left:42%;top:72%;"></a>
            <a class="hight-light lever-deadbolt" data-item="Lever + Deadbolt" data-name="COMBO" style="left:78%;top:76%;"></a>
            <a class="hight-light wifi-adaptor" data-item="WiFi Adaptor" data-name="BRIDGE" style="left:71%;top:81%;"></a>
            <a class="hight-light" data-item="coming-soon" data-name="COMINGSOON" style="left:9%;top:62%;"></a>
</div>

this class hight-light is a point in a div. The scenario is to click on different points and pop up different products. Now we have done this step, but how to judge that the content of only one point can be displayed? if the pop-up layer of this point is not turned off, other points cannot be clicked.

clipboard.png

//
        $(".house").on("click",".hight-light",function(){
            var proName = $(this).attr("data-name");
            $(".show-item").map(function(index){
                var showItem = $(this).attr("data-pro");
                if(proName == showItem){
                    $(this).toggleClass("show");
                    $(this).find(".pro-contet").toggleClass("scale-one");
                }else{
                    return false;
                }
            })
        });

how should I write this? Because the pop-up layer is not full-screen, there is no way to cover other points with the full-screen background of the pop-up layer only in the div area you see.

Jun.26,2021

just add a logo

var isShowRoom = false;
 $('.house').on('click','.hight-light',function(){
            if(isShowRoom) return;
            var proName = $(this).attr('data-name');
            $('.show-item').map(function(index){
                var showItem = $(this).attr('data-pro');
                if(proName == showItem){
                    $(this).toggleClass('show');
                    //true,false
                    isShowRoom = true;
                    $(this).find('.pro-contet').toggleClass('scale-one');
                }else{
                    return false;
                }
            })
        });

define a tag var tag = null; , save the selected box tag = $(this). ToggleClass ('show'); , and then. It is the first time that the tag exists when it is executed, and then the show class is determined.

how do you look at your code? it looks like the switches are all on the same button. if (tag & & tag.hasClass ('show') & &! $(this) .hasClass (' show')) return; ) is changed to this. The tag exists, and there is a show tag, so it is determined that if you click on a show, it will be released.


var tag = null;
$('.house').on('click','.hight-light',function(){
        var proName = $(this).attr('data-name');
        $('.show-item').map(function(index){
            var showItem = $(this).attr('data-pro');
            if(proName == showItem){
                if(tag && tag.hasClass('show') && !$(this).hasClass('show')) return;
                tag = $(this).toggleClass('show');
                $(this).find('.pro-contet').toggleClass('scale-one');
            }else{
                return false;
            }
        })
    });
Menu