Using jQuery, I would like to disable scrolling of the body:
My idea is to:
body{ overflow: hidden;}
scrollTop();/scrollLeft()
Is there a better way?
Update:
Please see my example, and a reason why, at http://jsbin.com/ikuma4/2/edit
I am aware someone will be thinking "why does he not just use position: fixed
on the panel?".
Please do not suggest this as I have other reasons.
This will completely disable scrolling:
$('html, body').css({
overflow: 'hidden',
height: '100%'
});
To restore:
$('html, body').css({
overflow: 'auto',
height: 'auto'
});
Tested it on Firefox and Chrome.