0
我有以下腳本啓動幻燈片插件:上導航的userAgent執行腳本不匹配
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)) {}
});
我該怎麼做?
將代碼放在'if'的'else'子句中。 – Barmar
if(condition){code} else {code} – mpm