Answers for "when do we use scroll listener in javascript"

1

when do we use scroll listener in javascript

var myElement=document.getElementById("someElementID");
myElement.addEventListener("scroll", function(ev){
	ev.target.scrollTop;//pixels scrolled from element top
	ev.target.scrollHeight;//pixels of the whole element.
})
Posted by: Guest on June-09-2021

Code answers related to "when do we use scroll listener in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language