javascript - Hiding overflow on HTML tag makes browser jump to top of the page -


when set style on html tag, in angularjs:

angular.element($document[0].documentelement).css('overflow', 'hidden'); 

the page jumps top of page. how can prevent this?

i trying display full page overlay, , when try scroll, background scrolls. doesn't scroll when set overflow: css style on html tag. has lead me problem.

when hide document, you're telling browser not scroll. that's why you're being directed top of page, page in essence no longer extends beyond viewport.

while not every browser send top of page (expected behavior here lock user page they're at), active tracking of hash (e.g. mypage.com/#showlogin/) angular uses routing cause page jump top of screen.


edit:

if want keep background doesn't scroll page, use property background-attachment:

html, body {   ... /* other code here */   background-attachment: fixed; } 

Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -