View ScrollBarWidth
function getScrollBarWidth(bool) { | |
if(bool == true) { | |
var $outer = $('<div>').css({visibility: 'hidden', width: 100, overflow: 'scroll'}).appendTo('body'), | |
widthWithScroll = $('<div>').css({width: '100%'}).appendTo($outer).outerWidth(); | |
$outer.remove(); | |
return 100 - widthWithScroll; | |
} else { | |
return 0; | |
} | |
} |
View click_outside
$(document).click(function (event) { | |
if (!$(event.target).closest(".selector").length) { | |
// what event | |
} | |
event.stopPropagation(); | |
}); |