|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / code / Swissup / Stickyfill / |
Filename | /home/dev2.destoffenstraat.com/app/code/Swissup/Stickyfill/README.md |
Size | 1.82 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 30-Jul-2020 14:42 |
Last accessed | 22-Aug-2025 14:03 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
# Stickyfill
Stickyfill - is a Magento2 module that integrates
[Stickyfill library](https://github.com/wilddeer/stickyfill) into Magento.
The module also provides [additional features](#additional-features): it may
add `sticky-active` class, when element is actually stuck at the moment.
### Installation
```bash
cd <magento_root>
composer require swissup/module-stickyfill
bin/magento module:enable Swissup_Stickyfill
bin/magento setup:upgrade
```
### Usage
Basic example:
```js
require(['stickyfill'], function (Stickyfill) {
Stickyfill.add(document.querySelectorAll('.sidebar'));
});
```
> See all available methods at official site: https://github.com/wilddeer/stickyfill#api
Advanced example (works for dynamically added elements):
```js
require([
'Magento_Ui/js/lib/view/utils/async',
'stickyfill'
], function ($, Stickyfill) {
$.async('.sidebar', function (el) {
Stickyfill.add(el);
});
});
```
### Additional features
`Swissup_Stickyfill/js/sticky` - is a proxy to stickyfill library that adds
`sticky-active` class name when element is stuck. It has the following methods:
Method | Description
--------|------------
add | Proxy to `Stickyfill.add`
remove | Proxy to `Stickyfill.remove`
stickyfill | Returns `Stickyfill` object
Basic usage:
```js
require([
'Swissup_Stickyfill/js/sticky'
], function (sticky) {
sticky.add(document.querySelectorAll('.sidebar'))
});
```
Using with matchMedia library:
```js
require([
'matchMedia',
'Swissup_Stickyfill/js/sticky'
], function (mediaCheck, sticky) {
'use strict';
var sidebar = document.querySelectorAll('.sidebar');
mediaCheck({
media: '(min-width: 768px)',
entry: function () {
sticky.add(sidebar);
},
exit: function () {
sticky.remove(sidebar);
}
});
});
```
Stickyfill - is a Magento2 module that integrates
[Stickyfill library](https://github.com/wilddeer/stickyfill) into Magento.
The module also provides [additional features](#additional-features): it may
add `sticky-active` class, when element is actually stuck at the moment.
### Installation
```bash
cd <magento_root>
composer require swissup/module-stickyfill
bin/magento module:enable Swissup_Stickyfill
bin/magento setup:upgrade
```
### Usage
Basic example:
```js
require(['stickyfill'], function (Stickyfill) {
Stickyfill.add(document.querySelectorAll('.sidebar'));
});
```
> See all available methods at official site: https://github.com/wilddeer/stickyfill#api
Advanced example (works for dynamically added elements):
```js
require([
'Magento_Ui/js/lib/view/utils/async',
'stickyfill'
], function ($, Stickyfill) {
$.async('.sidebar', function (el) {
Stickyfill.add(el);
});
});
```
### Additional features
`Swissup_Stickyfill/js/sticky` - is a proxy to stickyfill library that adds
`sticky-active` class name when element is stuck. It has the following methods:
Method | Description
--------|------------
add | Proxy to `Stickyfill.add`
remove | Proxy to `Stickyfill.remove`
stickyfill | Returns `Stickyfill` object
Basic usage:
```js
require([
'Swissup_Stickyfill/js/sticky'
], function (sticky) {
sticky.add(document.querySelectorAll('.sidebar'))
});
```
Using with matchMedia library:
```js
require([
'matchMedia',
'Swissup_Stickyfill/js/sticky'
], function (mediaCheck, sticky) {
'use strict';
var sidebar = document.querySelectorAll('.sidebar');
mediaCheck({
media: '(min-width: 768px)',
entry: function () {
sticky.add(sidebar);
},
exit: function () {
sticky.remove(sidebar);
}
});
});
```