sectionClasses
@blackbyte.sugar.js.dom.feature
This feature allows you to add some classes on your sections when they are in the viewport, near the viewport, above, etc…
-in-viewport: Added when the section is in the viewport-from-above: Added when the section enters the viewport from above-from-below: Added when the section enters the viewport from below-above-viewport: Added when the section is above the viewport-below-viewport: Added when the section is below the viewport
Params
- settings{}TSectionClassesSettings
The settings you want to override
Example
import { sectionClasses } from '@blackbyte/sugar/features';
sectionClasses();Settings
- inClass’-in-viewport’String
The class to add when the section is in the viewport
- keepInClassWhenAbovefalseBoolean
Whether to keep the inClass when the section is above the viewport
- [fromAboveClass=’-from-above’] The class to add when the section enters the viewport from above*-String
null
- [fromBelowClass=’-from-below’] The class to add when the section enters the viewport from below*-String
null
- [aboveClass=’-above-viewport’] The class to add when the section is above the viewport*-String
null
- [belowClass=’-below-viewport’] The class to add when*-String
null
- offset25Number
The offset in px to consider the section is in the viewport