Reputation: 77
I have the following script that starts a slideshow plugin:
var slideshow=new TINY.slider.slide('slideshow',{
id:'slider',
auto:4,
resume:false,
vertical:false,
navid:'pagination',
activeclass:'current',
position:0,
rewind:false,
});
And I want to combine it with this other script that detects the userAgent, so the previous script runs only if the userAgent DOES NOT match the listed user agents:
$(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)) {}
});
How can I do that?
Upvotes: 0
Views: 2188
Reputation: 796
$(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
}
});
Upvotes: 1