我有以下脚本启动幻灯片插件:
var slideshow=new TINY.slider.slide('slideshow',{
id:'slider',
auto:4,
resume:false,
vertical:false,
navid:'pagination',
activeclass:'current',
position:0,
rewind:false,
});
我想将其与检测userAgent的其他脚本结合使用,因此只有当userAgent与列出的用户代理不匹配时,才会运行上一个脚本:
$(document).ready(function(){
if(navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)) {}
});
我该怎么做?
答案 0 :(得分:1)
$(document).ready(function(){
if(!(navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)))
{
// your code here
}
});