I am using Fancybox 2 for image gallery. I am trying to figure out how can I make auto thumbnail via source image. In example there are 2 image one of them is original and the other one is thumbnail image. I want to set only original image and Fancybox should create thumbnail automatically.
<p>
<a class="fancybox" rel="gallery1" href="http://farm2.staticflickr.com/1617/24108587812_6c9825d0da_b.jpg"> </a>
<a class="fancybox" style="margin-left: 20px" rel="gallery1" href="http://farm4.staticflickr.com/3691/10185053775_701272da37_b.jpg"></a>
<a class="fancybox" style="margin-left: 20px" rel="gallery1" href="http://farm1.staticflickr.com/574/22407305427_69cc6e845f_b.jpg"></a>
<a class="fancybox" style="margin-left: 20px" rel="gallery1" href="http://farm1.staticflickr.com/291/18653638823_a86b58523c_b.jpg"></a>
</p>
js
$("a.fancybox").fancybox({
openEffect: 'none',
closeEffect: 'none'
});
As you see I didn't specify thumbnails img. Is there any way to create automatically? And my thumbnail count various. It can be between 1-10.
Something like this?
jQuery('.fancybox').each(function(i,e){
jQuery(e).css('background-image','url('+jQuery(e).attr('href')+')');
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.