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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -