Why does fancybox require two clicks activate?

后端 未结 1 1939
旧时难觅i
旧时难觅i 2020-12-20 09:11

jQuery

  

        
相关标签:
1条回答
  • 2020-12-20 09:24

    fancybox works on click.

    Try this instead (attach fancybox to all the places you want it):

      jQuery("a.fancybox_videojs").click(function(){return false;})
        .each(function(i,item) {
            var url = jQuery(this).attr('title');
            var rel = jQuery(this).attr('rel');
            var img = jQuery(this).children('img').attr('src');
    
            jQuery(this).fancybox({
                'overlayOpacity' : <?php echo get_option('fancybox_overlayOpacity'); ?>,
                'overlayColor' : '<?php echo get_option('fancybox_overlayColor'); ?>',
                'hideOnContentClick' : false,
                'content': '<div><div class="video-js-box vim-css">' +
                              '<video id="example_video_1" class="video-js" width="650" height="370" controls="controls" preload="auto" poster="' + img + '">' +
                              [...omitted...]
                              '</video>' +
                              '</div></div>',
                'titleShow' : false,
                'onComplete': function () { 
                    jQuery("#fancybox-inner").css({ 'overflow': 'hidden' });
                    VideoJS.setupAllWhenReady();
                },
                'onClosed': function () { jQuery("#fancybox-inner").empty(); }
            });
        });
    
    0 讨论(0)
提交回复
热议问题