timneutkens / magento2-module-enquire-js
该软件包已被废弃,不再维护。未建议替代包。
将Enquire.js从CDN作为require.js模块模拟。当CDN离线时,回退到本地版本。
2.1.6.1
2022-12-08 13:35 UTC
This package is not auto-updated.
Last update: 2024-06-08 18:10:49 UTC
README
将Enquire.js从CDN作为require.js模块模拟。当CDN离线时,回退到本地版本。
安装
-
使用以下命令安装最新版本:composer require weprovide/magento2-module-enquire-js
如果您想要指定Enquire.js的版本,可以使用以下命令:
composer require weprovide/magento2-module-enquire-js:<版本号>
-
运行
bin/magento setup:upgrade
-
运行
bin/magento setup:static-content:deploy
可用版本
- 2.1.2
- 2.1.6
用法
关于enquire.js的用法示例,请参阅enquire.js网站
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 }); });