HTML ---> Auto Scrolling / Focusing on an Element With or Without JavaScript / jQuery

Your Rating: not set
I have heard that auto scrolling was dead, but however I think that autoscrolling can be usefull for many purposes. Such as:

1. When clicking a link focusing on a paragraph.
    - FAQs webpage
2. When loading a webpage taking users straight to a section of the webpage.
    - Focusing on the comments that are below a blog post
3. Taking user's to the bottom of a webpage and to the top of a webpage without having to scroll a massive amount, which users tend not to scroll much.

Below are two examples of how to focus a browser on different sections of a webpage. One example is using nothing but HTML and the other example uses jQuery.

The first example uses the first href in the first li of the ul below. As you can see the link's href has "#example1" inside. Which is the id of one of the divs. Upon clicking the link the href="#example1" will go on the address bar at the very end of the URL and instantly your browser will focus on the div with id of "example1".

The second example uses jQuery which adds an onclick event to the href with id of "linkExample2". Upon the link being clicked the browser's scrollbar will scroll for 2 seconds until the div with id of "example2" is within view.





UserName: Daniel
Date Joined: 12/16/2010

WebsiteURL: http://www.justaboutdaniel.com
Bio: I am a full time web developer, son, and friend to many. For more read my about me located here.


Name:
Email:
Website URL:
Comments:
 
Note:



Anonymous 12/21/2011 7:50:14 PM

Hey, klelir job on that one you guys!



Coming soon!

17

Skip Navigation Links.

Users

ads and stuff