Search code examples
jqueryjquery-blockui

Dismiss BlockUI on click outside element


I'm using BlockUI block a page. The element used by BlockUI covers the lower half of the page. Although I have a close button on the element, which works just fine, I alos need to unblock if there is a click in the are above my element. Is this possible?


Solution

  • jsFiddle Demo

    I have come across a similar need before. You will need to know the layer that the BlockUI is on. I will assume that it has a z-index of 10. What you are going to want to do here is set an invisible layer beneath it and then attach a click event there which will tie into the close event already on your blockui element.

    .clr{
     position:fixed;
     width:100%;
     height:100%;
     z-index:5;
     top:0;
     left:0;
     bottom:0;
     right:0;
    }