Pop-up box click on another partial shutdown

Do web page, it is often encounter pop-up box semi-transparent background color, usually will want to return or click the Close button to close part of the background color pop and pop is a descendant of the background color

Ideas: the background color of the box to set up a class class, get event source object by clicking on the event jq (is the current click) to determine whether click through here is the background color box to determine the class name

$ ( "Background color of the box type") .click (function (e) {
  if ($(e.target).attr('class') == '类名') {
    $ (. "Background box") .hide ();
  }
})
 
 

Guess you like

Origin www.cnblogs.com/clt-web/p/11243702.html