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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -