🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

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

Events Plugins

Documentation

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.

You May Also Like