Rotating content
Scrolling content with effects in the iPhone and Mac OS is very attractive. In Web 2.0 sites, too, we sometimes require to fly or scroll the contents. That content rotation is usually needed for news tickers, announcement scrollers, stylish effects to present content like slideshows, and so on. The jQuery ecosystem has lot of plugins for that purpose. However, the jQuery.scrollTo
plugin is relatively simple, provides lot of effects, and can therefore effectively be used in many situations.
Getting ready
Along with the jQuery core library, we'll require the jQuery.scrollTo
plugin from http://plugins.jquery.com/project/ScrollTo.
How to do it...
Here, we'll see how to scroll the content of the div
container dynamically, using JavaScript. Initially, the HTML markup is straightforward, with a div
container and links to trigger scroll down or up events.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns...