Simple jQuery Plugin For Scrolling To Any Html Elements
File Size: | 2.59 KB |
---|---|
Views Total: | 967 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |

An extremely simple and cross-browser jQuery plugin that allows you create a link/button to scroll to any html elements by ID Selector. Good for scroll to top, scroll to bottom, etc.
How to use it:
1. Include jQuery library and jquery.scroll.to.id.js on your html page
<script type="text/javascript" src='http://code.jquery.com/jquery-1.9.1.min.js'></script> <script type="text/javascript" src="jquery.scroll.to.id.js"></script>
2. Create a container which you want to scroll to
<div id="content"> <div id="two">TWO</div> </div>
3. Create a button to scroll to the container with ID 'two'
<button id="moveToTwo">Move to TWO</button>
4. The javascript
<script type="text/javascript"> $(document).ready(function(){ $('#moveToTwo').click(function(){ $('#content').scrollToID('#two') }) }) </script>
5. Style your containers via CSS
This awesome jQuery plugin is developed by pasanlive. For more Advanced Usages, please check the demo page or visit the official website.