[英]how do i change the js slider effect to fade when my window width is less than 800px?
我正在寻找一种方法,以便当我的浏览器窗口小于800px时,我的js滑块将其效果从(现在正常)更改为淡入淡出。 有人可以帮忙吗?
<ul class="slider">
<li><img src="images/1" alt="img" width="979" height="470"></li>
<li><img src="images/2" alt="img" width="979" height="470"></li>
<li><img src="images/3" alt="img" width="979" height="470"></li>
</ul>
$('.slider').bxSlider({
navigation : true,
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true,
});
您可以滚动自己的脚本来侦听调整大小事件,然后检测窗口是否小于800像素宽,但是我会亲自检查一下enquire.js中的特定问题。 使用enquire.js,您的解决方案就很容易。
enquire.register("screen and (max-width:800px)", {
// OPTIONAL
// If supplied, triggered when a media query matches.
match : function() {
//Code goes in here to change your slider to fade
},
// OPTIONAL
// If supplied, triggered when the media query transitions
// *from a matched state to an unmatched state*.
unmatch : function() {}
//Code goes in here to set your slider transition type to normal
});
希望能有所帮助。 查询对我来说是一个了不起的工具!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.