Skip to content

Instantly share code, notes, and snippets.

@hadl
Last active July 1, 2020 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadl/81dc6a288b4f27109d3986dbcc30c58f to your computer and use it in GitHub Desktop.
Save hadl/81dc6a288b4f27109d3986dbcc30c58f to your computer and use it in GitHub Desktop.
Flickity & Lazysizes
/* eslint-disable no-underscore-dangle,prefer-rest-params */
import Flickity from 'flickity';
(() => {
const oldFlickityCreate = Flickity.prototype._create;
Flickity.prototype._create = function create() {
const that = this;
if (this.element.addEventListener) {
this.element.addEventListener('load', () => {
that.onresize();
}, true);
}
this._create = oldFlickityCreate;
return oldFlickityCreate.apply(this, arguments);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment