1.0.8 • Published 4 years ago
@atyoursite/classnames v1.0.8
ClassNames
ElClassName Class
Description
This class is for manipulating classNames
Installation
Open a terminal window inside the root of your project to install the node package.
npm install --save-dev @atyoursite/classnames
Dependency
To be able to use this class, you will have to import it as a dependency
import { ElClassName } from '@atyoursite/classnames';
Instantiate the class
Class parameters
- el - jQuery element
- className - Default 'is-hidden'
example
const topNavHide = new elClassName($('#elFixedNavbar'), 'your-class');
Method fromPosition() parameters
- offset - scrollTop offset to toggle the className
Usage
// Hide and show navigation based on scrolling position and behavior
const topNavHide = new elClassName($('#elFixedNavbar'));
window.addEventListener("scroll", throttle(topNavHide.fromPosition(800), 300));