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?".
position: fixed
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.
1.4m articles
1.4m replys
5 comments
57.0k users