jquery - Using fancybox-media with fancybox-thumbs -
jquery - Using fancybox-media with fancybox-thumbs -
i'm trying create (combined) image , youtube video gallery using fancybox while utilizing fancybox thumbs. i've run 2 problems:
when click on link video (the first link - ps, i'm not trying rick roll when click on lol), opens up, doesn't show thumbs or allow navigate through other items in group if click on link image (the sec or 3rd link), shows of thumbnails generate - including thumbnail video.... when click on thumbnail video, doesn't skip video.thoughts?
$('.fancybox-thumbs').fancybox({ preveffect : 'none', nexteffect : 'none', closebtn : true, arrows : true, nextclick : true, helpers : { thumbs : { width : 50, height : 50 } } }); $('.fancybox-media') .attr('rel', 'media-gallery') .fancybox({ openeffect : 'none', closeeffect : 'none', preveffect : 'none', nexteffect : 'none', arrows : true, helpers : { media : {}, buttons : {} } });
here's have far: http://jsfiddle.net/6j7wxr8e/
first notice elements of fancybox gallery must share both, same selector , same rel
attribute (or same data-fancybox-group
attribute)
in example, selectors .fancybox-thumbs
, .fancybox-media
cannot belong same gallery regardless share same rel
attribute. applies elements sharing same selector different rel
attribute value. create sense?
so create sure elements share same selector like
<a class="fancybox"> <a class="fancybox"> <a class="fancybox">
you may not need hard-code rel
attribute since initialize fancybox :
$('.fancybox').attr('rel', 'media-gallery').fancybox();
... sets same rel
attribute (media-gallery
) elements class fancybox
.
then grouping api options in single initialization script, including fancybox helpers media, thumbs, buttons etc. like
jquery(document).ready(function ($) { $('.fancybox').attr('rel', 'media-gallery').fancybox({ preveffect: 'none', nexteffect: 'none', closebtn: true, arrows: true, nextclick: true, helpers: { thumbs: { width: 50, height: 50 }, // requires include thumbs js , css files media: {}, // requires include media js file buttons: {} // requires include buttons js , css files } }); });
see forked jsfiddle
jquery youtube fancybox thumbnails fancybox-2
Comments
Post a Comment