Question

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?

Was it helpful?

Solution

$(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
     }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top