javascript - document.documentElement.scrollTop condition -
trying understand first part of conditional statement in code
window.addeventlistener("scroll",function(event){ if(document.documentelement.scrolltop || document.body.scrolltop >= scrolldistance){ animatepoints();
the second part says, if number of pixels have scrolled top of body greater or equates point want animation start, call function in mind, work possible scenario
i don't understand first conditional (and have tried messing around in console)
console.log(document.documentelement.scrolltop)
returns 0. understanding because never scrolling root element <html>
return @ 0.
if true first condition met , should fire animatepoints function (yet isn't)
basically if document.documentelement.scrolltop
isn't 0, false, undefined, null or '' runs second statement document.body.scrolltop >= scrolldistance
.
Comments
Post a Comment