1

我正在尝试将 FancyBox 脚本与自定义幻灯片结合使用,但我无法使其工作。

这是我的页面: http ://www.edital.co.il/?page_id=37 (如果链接不起作用,请等待并重新加载)

如您所见(第 53 行),我在 fancybox 加载后立即弹出了它,只是为了测试 fancybox 是否正常工作。

问题始于脚本'http://www.edital.co.il/wp-content/themes/ediTal/library/js/libs/zoom-showcase.js?ver=3.4.2'(脚本在行加载145) 在文件内部,第 57 行:$this.trigger('click');

function gotoURL(event) {
    var $this = $(this); // the <li> that has the youtube href attribute.
    // the <li> has class="fancybox-youtube", so it should work:
    $this.trigger('click'); // should trigger the <li>, but its not! (the problem)
}

触发器由 fancybox 在 html 文件的第 67 行设置:

jQuery(document).ready(function($){
    /* Fancybox code start... */
    var fb_timeout = null;
    var fb_opts = { 'overlayShow' : true, 'centerOnScroll' : true, 'showCloseButton' : true, 'showNavArrows' : true, 'onCleanup' : function() { if(fb_timeout) { window.clearTimeout(fb_timeout); fb_timeout = null; } } };
    $('[href*="youtube.com/"]:not(.nofancybox)').addClass('fancybox-youtube');
    $('[href*="youtu.be/"]:not(.nofancybox)').addClass('fancybox-youtube');
    $('.fancybox-youtube').fancybox( $.extend({}, fb_opts, { 'type' : 'iframe', 'width' : 640, 'height' : 390, 'padding' : 0, 'autoScale' : false, 'titleShow' : false, 'titlePosition' : 'float', 'titleFromAlt' : true, 'onStart' : function(selectedArray, selectedIndex, selectedOpts) { selectedOpts.href = selectedArray[selectedIndex].href.replace(new RegExp('youtu.be', 'i'), 'www.youtube.com/embed').replace(new RegExp('watch\\?v=([a-z0-9\_\-]+)(&|\\?)?(.*)', 'i'), 'embed/$1?version=3&$3') } }) );
    /* Fancybox code end... */

    /* Thats working, but gotoURL() does not. */ 
    $('a[class=fancybox-youtube]').filter(':first').trigger('click'); 
});

基本上是怎么回事:Fancybox 正在向任何带有 href=youtube 的标签添加“fancybox-youtube”类...

我的猜测-他们都有不同的美元,这就是他们不一起工作的原因。我不知道这是否是导致问题的原因。

4

0 回答 0