How to set group for images without link in Fancybox?
问题 Currently I use this code for apply Fancybox to a set of images not wrapped by tag <A> : $("img[alt=lightbox]").each(function(){ $(this).fancybox({ href : $(this).attr('src') }); }); Now I'd like to add to the same group all images added in this way. I tried with: $("img[alt=lightbox]").each(function(){ $(this).attr("data-fancybox-group", "gallery"); $(this).fancybox({ href : $(this).attr('src') }); }); Without luck, do you have any advice? 回答1: The answer for this question Fancybox gallery