Using jQuery, I would like to disable scrolling of the body:
My idea is to:
- Set
body{ overflow: hidden;}
- Capture the current
scrollTop();/scrollLeft()
- Bind to the body scroll event, set scrollTop/scrollLeft to the captured value.
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.
Aucun commentaire:
Enregistrer un commentaire