Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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.
})
 
PREVIOUS NEXT
Tagged: #scroll #listener #javascript
ADD COMMENT
Topic
Name
2+5 =