Is it possible to disable the browsers vertical and horizontal scrollbars using jQuery or javascript?
Because Firefox has an arrow key short cut, you probably want to put a <div>
around it with CSS style: overflow:hidden;
.
Using JQuery you can disable scrolling bar with this code :
$('body').on({
'mousewheel': function(e) {
if (e.target.id == 'el') return;
e.preventDefault();
e.stopPropagation();
}
});
Also you can enable it again with this code :
$('body').unbind('mousewheel');
In case you also need support for Internet Explorer 6, just overflow the html
$("html").css("overflow", "hidden");
and
$("html").css("overflow", "auto");
function reloadScrollBars() {
document.documentElement.style.overflow = 'auto'; // firefox, chrome
document.body.scroll = "yes"; // ie only
}
function unloadScrollBars() {
document.documentElement.style.overflow = 'hidden'; // firefox, chrome
document.body.scroll = "no"; // ie only
}
Try CSS
<body style="overflow: hidden">