嗨 friend 们,我必须在手机上打开时禁用视差效果脚本。 我找到了一个与我想要的类似的脚本并进行了改编,但它不起作用。有谁知道出了什么问题吗?
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
jQuery(document).ready(function(){
if( !isMobile.any()){
$(window).stellar(): false;
}
});
最佳答案
$(window).stellar()
后面的: false
是什么?我不确定你想在那里做什么,或者这只是某种复制/粘贴错误或其他什么,但这会给出:
SyntaxError: Unexpected token :
我想你想要这个:
jQuery(document).ready(function(){
if( !isMobile.any()){
$(window).stellar();
}
});
关于javascript - 禁用手机脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16918369/