Javascript 某些链接上的FancyBox导航
你好,这里是StackOverfow的好朋友,我需要帮助查看FancyBox导航箭头。我需要它们在图像组上始终可见,而且在FancyBox窗口中打开的视频上不可见 我对图像的代码是:Javascript 某些链接上的FancyBox导航,javascript,jquery,fancybox,Javascript,Jquery,Fancybox,你好,这里是StackOverfow的好朋友,我需要帮助查看FancyBox导航箭头。我需要它们在图像组上始终可见,而且在FancyBox窗口中打开的视频上不可见 我对图像的代码是: $("a[rel=images]").fancybox({ 'transitionIn' : 'none', 'transitionOut' : 'none', 'showNavArrows' : 'true', 'titlePosition' : 'over', '
$("a[rel=images]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'showNavArrows' : 'true',
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image <strong>'
+ (currentIndex + 1)
+ ' </strong>/ '
+ currentArray.length
+ (title.length ? ' ' + title : '')
+ '</span>';
}
});
在FancyBox窗口中打开视频的代码为:
$(".video").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 700,
'height' : 450,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'showNavArrows' : 'false',
'allowfullscreen' : 'true'
}
});
//$('.fancy-ico').hide();
return false;
});
当我点击视频链接时,fancybox窗口会显示两个导航箭头,这是可以理解的,因为这就是我添加的两行CSS的目的。当我添加一行代码时,如下所示:
$('.fancy-ico').hide();
视频窗口将打开,但没有任何箭头,仍然正常。问题是,当我再次单击图像时,箭头不会显示,因为我用最后一行jquery隐藏了箭头
现在我的问题是,我如何才能使这项工作?在哪里可以插入一段代码,如下所示:
$('.fancy-ico').show();
有没有更聪明的方法来做这样的事情
感谢大家提供的帮助您可以使用onStart功能对图像编码: 因此,每次加载图像fancybox时,它也将显示箭头
$("a[rel=images]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'showNavArrows' : 'true',
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image <strong>' + (currentIndex + 1) + ' </strong>/ ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
// onStart: "Will be called right before attempting to load the content"
'onStart' : function() {$('.fancy-ico').show();}
});
$(“a[rel=images]”)。fancybox({
“transitionIn”:“无”,
“transitionOut”:“无”,
'showNavArrows':'true',
“标题位置”:“结束”,
“标题格式”:函数(标题、currentArray、currentIndex、currentOpts){
返回'Image'+(currentIndex+1)+'/'+currentArray.length+(title.length?''+title:'')+'';
}
//onStart:“将在尝试加载内容之前调用”
“onStart”:函数(){$('.ico').show();}
});
还有一件事,您的视频是swf对象吗?如果是,则即使您不“$('.fancy ico').hide();”,箭头也可能不会显示-具体来说,flash始终显示在其他元素的顶部,因此箭头可能会显示在“下方”。您可以通过删除“$('.fancy ico').hide();和$('.fancy ico').show();”来测试这一点
$("a[rel=images]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'showNavArrows' : 'true',
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image <strong>' + (currentIndex + 1) + ' </strong>/ ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
// onStart: "Will be called right before attempting to load the content"
'onStart' : function() {$('.fancy-ico').show();}
});