jQuery scrollTop Method
home
Run
screen_rotation
fullscreen
cloud_download
navigate_before
<!DOCTYPE html> <html> <head> <title>jQuery Demo example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "#scrollTopExample" ).on( "click", function(event) { $("#myDiv").scrollTop(50); }); }); </script> <style> .myClass{ border:1px solid red; background:green; width:300px; height:100px; overflow-x:scroll; } </style> </head> <body> <h4 ><a href="javascript:void(0);" id="scrollTopExample">Click to run .scrollTop() Example </a></h4> <div id="myDiv" class="myClass"> <p > Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content.. </p> </div> </body> </html>
<!DOCTYPE html> <html> <head> <title>jQuery Demo example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "#scrollTopExample" ).on( "click", function(event) { $("#myDiv").scrollTop(50); }); }); </script> <style> .myClass{ border:1px solid red; background:green; width:300px; height:100px; overflow-x:scroll; } </style> </head> <body> <h4 ><a href="javascript:void(0);" id="scrollTopExample">Click to run .scrollTop() Example </a></h4> <div id="myDiv" class="myClass"> <p > Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content.. Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content..Scroll left Demo..content.. </p> </div> </body> </html>
Copyrights@tutorialsplane.com