Friday, March 30, 2012

Scroll page with javascript

Sometimes it's useful to scroll the page automatically to send users to certain parts of the page. To do that the easiest way is using javascript, more specifically jquery that is a javascript framework.

Test it here:

Scroll down!
Example code:

function scroll_up()
function scroll_to_last_div()
<div style="height:100px;width:400px;">
<a href="javascript:scroll_to_last_div();">Scroll to last div!</a>
<div style="height:600px;width:400px;background:#234a34;">
<div style="height:100px;width:400px;" id="last_div">
<a href="javascript:scroll_up();">Scroll to top!</a>
<div style="height:600px;width:400px;background:#fa342a;">

1 comment:

  1. Thanks for such social platform which give us variety of idea to explore ourself technically .This exposure give benefits to everyone to fit or to survive in global market which is very essential in the global era.
    Time Attendance System