HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> #outerDiv{ height:150px; width:200px; border:1px solid black; overflow: auto; } #innerDiv{ height:1500px; width:2000px; } </style> </head> <body> <div id="outerDiv" onscroll="myFunction()"> <div id="innerDiv">Scroll me right and left</div> </div> <p id="point"></p> <script> var x = document.getElementById("point"); var elem = document.getElementById("outerDiv"); function myFunction(){ x.innerHTML = "scrollLeft = " +elem.scrollLeft; } </script> </body> </html>
OUTPUT
×

Save as Private