javascript - body.scrollTop is not working in firefox and IE When inside Blogger -


here javascript. working in chrome not working in firefox , ie when inside blogger

if (document.body.scrolltop > 5) {           var header = document.getelementsbyclassname("header")[0];           header.classname = "header down" } 

and have trie it

if (document.getelementsbytagname('body')[0].scrolltop > 5) {           var header = document.getelementsbyclassname("header")[0];           header.classname = "header down"         } 

please tell how work in firefox , ie. please javascript , no j query.

i've had @ website javascript , can see in ie , firefox, document.body.scrolltop 0. see document.body.scrolltop 0 in ie when scrolling.

therefore, down never added header div. need use combination of document.body.scrolltop or document.documentelement.scrolltop depending on browser in use.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -