jQuery Simple Scroll To Plugin - scrollomatic

File Size: 5.66KB
Views Total: 878
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Simple Scroll To Plugin - scrollomatic

scroll-o-matic is a simple jQuery scroll plugin that allows to scroll to any section of your web page by click, which can be used for sticky header, scrolling to top, scrolling to next section, etc.

Basic Usage:

1. Include the latest jQuery library and jQuery scroll-o-matic plugin on your web page

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.scrollomatic.js"></script>

2. Create a container you want to scroll to

<section id="section">
</section>

3. Create a link to scroll to the container named 'section'

<a href="#section" class="scroll">Click</a>

4. Call the plugin with some options

<script type="text/javascript">
$(function () {
$('a.scroll').scrollomatic({
    duration: 200, // Scroll animation time in milliseconds
    offset:0, // Fixed offset to always consider as the "top of the page" when scrolling; useful for pages with fixed headers. Can be a literal or a function that returns a literal.
    after: // Function to execute after scrolling stops after an anchor is clicked. Context will be the clicked anchor. First argument is the fragment being navigated to.
});
});
</script>

This awesome jQuery plugin is developed by robhruska. For more Advanced Usages, please check the demo page or visit the official website.