我会在 Drupal 8 主题中使用这个 JS 库。所以我在我的项目中添加了它,然后在我的主题中添加了它:libraries.yml
at.enquire:
remote: https://raw.githubusercontent.com/WickyNilliams/enquire.js
version: "2.1.6"
license:
name: MIT
url: https://raw.githubusercontent.com/WickyNilliams/enquire.js/master/LICENSE
gpl-compatible: true
js:
https://cdnjs.cloudflare.com/ajax/libs/enquire.js/2.1.6/enquire.min.js: { type: external, minified: true }
dependencies:
- core/jquery
- core/matchmedia
然后加载 vi amy info.yml:
<script src="https://cdnjs.cloudflare.com/ajax/libs/enquire.js/2.1.6/enquire.min.js"></script>
在我的 js 文件中:
$(document).ready(function () {
enquire.register("screen and (min-width:768px) and (max-width:1024px) and (orientation: landscape) and (min-resolution:1dppx)", {
deferSetup : true,
setup : function() {
$(".acces_rubriques iframe").height('55vh').width('45vw');//Video Gde Taille HP
},
match : function() {
console.log('Enquire.js : BP pour: tabletlandscape');
//Video sur HP
$(".acces_rubriques iframe").height('55vh').width('65vw');//Video Gde Taille HP
},
unmatch : function() {
example.unmatch();
}
});//enquire.register(tabletlandscape)
});//Fin document.ready
但是我的 android Tab 上什么也没发生。
可能缺少什么?谢谢