swissup / module-stickybits
Stickybits is a lightweight alternative to `position: sticky` polyfills
Installs: 225
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 2
Open Issues: 0
Language:JavaScript
Type:magento2-module
This package is auto-updated.
Last update: 2024-12-12 19:41:28 UTC
README
This repo is just an integration of original library into Magento 2.
Stickybits is a lightweight alternative to position: sticky polyfills. It works perfectly for things like sticky headers.
See original repository for more information: https://github.com/dollarshaveclub/stickybits
Installation
cd <magento_root> composer require swissup/module-stickybits bin/magento module:enable Swissup_Stickybits bin/magento setup:upgrade
Usage
Basic example:
require(['stickybits'], function (stickybits) { stickybits('.sidebar'); });
See all examples at official site: https://github.com/dollarshaveclub/stickybits#basic-usage
Advanced example (works for dynamically added elements):
require([ 'Magento_Ui/js/lib/view/utils/async', 'stickybits' ], function ($, stickybits) { $.async('.sidebar', function (el) { stickybits(el, { useStickyClasses: true, stuckClass: 'is_stuck' }); }); });