$(document).ready(function(){
var $windows = $('.window');
$windows.windows({
snapping: true,
snapSpeed: 200,
snapInterval: 800,
onScroll: function(s){},
onSnapComplete: function($el){},
onWindowEnter: function($el){}
});
});嗨,我需要知道如何禁用此脚本基于浏览器的宽度。因此,当浏览器小于440px时,我希望捕捉为false。
很抱歉,如果我没有很好地表达这一点,谢谢!
发布于 2013-12-10 00:47:34
将true替换为条件,如果需要,该条件的计算结果为true或false
$windows.windows({
snapping: $(window).width() > 440 || $(window).height() > 440, //will be false when either dimension is less than 440, other wise it will be true
snapSpeed: 200,
snapInterval: 800,
onScroll: function(s){},
onSnapComplete: function($el){},
onWindowEnter: function($el){}
});发布于 2013-12-10 00:52:21
你在使用响应式设计吗?如果是这样,您可以只使用基于容器大小的If语句:
$(document).ready(function() {
if($(".container").css("width") <= "440px") {
...add your code here
}
});如果您设置为使用窗口大小,我相信您可以使用窗口大小应用此If语句。
希望这能有所帮助!
https://stackoverflow.com/questions/20475871
复制相似问题