timneutkens / magento2-module-enquire-js
Add Enquire.js from CDN as a require.js module shim. With fallback to local version when CDN is offline.
Installs: 49 588
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Type:magento2-module
This package is not auto-updated.
Last update: 2024-06-08 18:10:49 UTC
README
Add Enquire.js from CDN as a require.js module shim. With fallback to local version when CDN is offline.
Installation
-
composer require weprovide/magento2-module-enquire-js
will install the latest version. If you want a specific Enquire.js version you can use this:
composer require weprovide/magento2-module-enquire-js:<version here>
-
Run
bin/magento setup:upgrade
-
Run
bin/magento setup:static-content:deploy
Available versions
- 2.1.2
- 2.1.6
Usage
For usage examples of enquire.js see the enquire.js website
require(['enquire'], function (enquire) { enquire.register("screen and (max-width:1000px)", { match : function() {}, // OPTIONAL // If supplied, triggered when the media query transitions // *from an unmatched to a matched state* unmatch : function() {}, // OPTIONAL // If supplied, triggered when the media query transitions // *from a matched state to an unmatched state*. // Also may be called when handler is unregistered (if destroy is not available) setup : function() {}, // OPTIONAL // If supplied, triggered once immediately upon registration of the handler destroy : function() {}, // OPTIONAL // If supplied, triggered when handler is unregistered. Place cleanup code here deferSetup : true // OPTIONAL, defaults to false // If set to true, defers execution the setup function // until the media query is first matched. still triggered just once }); });