Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 当用户代理==iphone时,Fancybox更改rel_Jquery_Iphone_Fancybox - Fatal编程技术网

Jquery 当用户代理==iphone时,Fancybox更改rel

Jquery 当用户代理==iphone时,Fancybox更改rel,jquery,iphone,fancybox,Jquery,Iphone,Fancybox,当agent==iphone&ipod时,我想更改fancybox的rel属性,因为 fancybox在iphone上不起作用。画面很小,视频无法观看。我在分类页面上使用fancybox和magento 当iphone上的用户单击click me时,视频应在正常的youtube页面上打开,否则在计算机上fancybox应正常显示 我尝试了以下代码,但不起作用 还有其他解决办法吗 代码:根据您的代码,如果agentID不是iPhone/iPod,为什么不尝试初始化fancybox 。。。比如: v

当agent==iphone&ipod时,我想更改fancybox的rel属性,因为 fancybox在iphone上不起作用。画面很小,视频无法观看。我在分类页面上使用fancybox和magento

当iphone上的用户单击click me时,视频应在正常的youtube页面上打开,否则在计算机上fancybox应正常显示

我尝试了以下代码,但不起作用

还有其他解决办法吗


代码:

根据您的代码,如果agentID不是iPhone/iPod,为什么不尝试初始化fancybox

。。。比如:

var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod)/);
jQuery(document).ready(function () {
    // only initialize fancybox if agentID IS NOT iPhone/iPod
    if (!agentID) {
        jQuery("a[rel=fancybox]").fancybox({
            // API options
        })
    }
});