jQuery plugin that adds specified classes to an element based on scroll behavior.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
README.md
bower.json
docs.html
package.json

README.md

scrollClass

jQuery plugin that adds specified classes to an element based on scroll behavior.

Install with Bower

bower install --save scrollClass

Usage

Include jQuery

<script type="text/javascript" src="//code.jquery.com/jquery-3.0.0.min.js"></script>

Include scrollClass

<script type="text/javascript" src="./dist/scrollClass.min.js"></script>

Options

  • target (jQuery Object) [Default: $(this)]
    • The targeted element to change classes.
  • offset (number | function) [Default 100]
    • number - The number of pixels offset from the top of the document that determines when the CSS class passed in the class option will be toggled.
    • function - A function that returns a number value representing the number of pixels offset from the top of the document that determines when the CSS class passed in the class option will be toggled.
  • downClass (string) [Default "progressing"]
    • The class toggled on to the target element when the user is scrolling downward.
  • upClass (string) [Default "regressing"]
    • The class toggled on to the target element when the user is scrolling upward.