(jquery) Blackout the entire screen and highlight a section of the page?

后端 未结 5 726
不知归路
不知归路 2020-12-07 12:03

As per screenshot below. I am pretty sure someone has done this before! =)

The circle is a bonus, would be very happy with a solution that allows highlighting of a g

5条回答
  •  眼角桃花
    2020-12-07 12:21

    See example of the following here →

    No need for a plugin. This can be accomplished with very little jQuery code, showing a blackout overlay with the selected div at a z-index above it:

    $('.expose').click(function(e){
        $(this).css('z-index','99999');
        $('#overlay').fadeIn(300);
    });
    
    $('#overlay').click(function(e){
        $('#overlay').fadeOut(300, function(){
            $('.expose').css('z-index','1');
        });
    });
    

    According to the following HTML & CSS... just add the expose class to any element you want isolated on click:

    Some content


    .expose { position:relative; } #overlay { background:rgba(0,0,0,0.3); display:none; width:100%; height:100%; position:absolute; top:0; left:0; z-index:99998; }

    See example →

提交回复
热议问题