Advertisement
ensemblebd

GizmoMenu performance fix

Feb 25th, 2016
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         ////////////////////////////////////////////
  2.         // CLOSE MENU IF ANY OTHER BUTTON IS CLICKED
  3.         ////////////////////////////////////////////
  4.         $('html').on('mousedown',function(e){
  5.             if(e.which!==3 && settings.click_to_close) {
  6.                
  7.                 $('.gizmoMenu:visible').each(function() {
  8.                     var detectChild=$(this).is($(e.target));
  9.                     if (!detectChild) $(this).children().each(function() {
  10.                         if (!detectChild && $(this).is($(e.target))) {detectChild=true;}
  11.                     });
  12.                     if (!detectChild) {
  13.                         $(this).stop(true,false).animate({opacity:0},{duration:100,queue:false,complete:function(){
  14.                             // CLOSE ANY OPEN gizmoMENUS
  15.                             $(this).css('display','none').find('.active').removeClass('active').next().stop(true,true).slideUp('normal');
  16.                         }});
  17.                     }
  18.                 });
  19.             };
  20.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement