weprovide / magento2-module-enquire-js
此包已被弃用且不再维护。没有建议的替代包。
将 Enquire.js 从 CDN 作为 require.js 模块模拟器添加。当 CDN 离线时,回退到本地版本。
2.1.6.1
2022-12-08 13:35 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 }); });