Last active
July 1, 2020 08:20
-
-
Save hadl/81dc6a288b4f27109d3986dbcc30c58f to your computer and use it in GitHub Desktop.
Flickity & Lazysizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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