Search code examples
jqueryjquery-pluginscolorbox

jQuery colorbox gallery mix image and video


Im using colorbox plugin and i wanna include some videos on gallery see this code: http://jsfiddle.net/29Bb4/ basicly video not loading when next item loads any idea?

when i use like this:

$(".group1").colorbox({rel:'group1', iframe:true, width:"80%", height:"80%"}); it breaks gallery effect:

  • or is there any good popup plugin that i can use both images and videos ?

Solution

  • Since in your question you are allowing for alternate solutions/plugins, I'd suggest you use fancybox. Here is a demo of your example html.

    http://jsfiddle.net/lucuma/Skpyw/3/

    http://fancyapps.com/fancybox/

    <p><a class="group1" rel="group1" href="http://www.jacklmoore.com/colorbox/content/ohoopee1.jpg" title="Me and my grandfather on the Ohoopee.">Grouped Photo 1</a></p>
            <p><a class="group1" rel="group1" href="http://www.jacklmoore.com/colorbox/content/ohoopee2.jpg" title="On the Ohoopee as a child">Grouped Photo 2</a></p>
            <p><a class="group1" rel="group1" href="http://www.jacklmoore.com/colorbox/content/ohoopee3.jpg" title="On the Ohoopee as an adult">Grouped Photo 3</a></p>
    
            <p><a class='group1 fancybox.iframe' rel="group1" href="http://www.youtube.com/embed/KHy7DGLTt8g?rel=0" title="video">Video (Iframe/Direct Link To YouTube)</a></p>
    
    
    $(".group1").fancybox({
           maxWidth    : 800,
            maxHeight    : 600,
            fitToView    : false,
            width        : '70%',
            height        : '70%',
            autoSize    : false,
            closeClick    : false,
            openEffect    : 'none',
            closeEffect    : 'none' 
    });
    
    $('#btnOpen').click(function(e) {
       e.preventDefault();
        $('.fancybox:eq(0)').click();
    });