Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Latest commit

 

History

History
34 lines (19 loc) · 1.35 KB

README.md

File metadata and controls

34 lines (19 loc) · 1.35 KB

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.