I want to show "back-to-top" button when the screen resolution is bigger or equal 1200px. Of course, it depends on window width. Here is jQuery code:
var wW = $(window).width() + 17;
console.log(wW);
if (wW >= 1200) {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#oc-ontop').fadeIn('fast');
} else {
$('#oc-ontop').fadeOut('fast');
}
});
}
So, if you set the window width to 1200px, console show you the value 1200. But 1200 is the sum of window width (1183px) + scrollbar width (17px). How can I calculate scrollbar width in this function to be independent of it's width?