Webzster, see examples of fire code. Probably you need example 2.
Example 1: fire FancyBox for all linked images - like <a
href="image.jpg" alt="">(text | <img src="thumb.jpg" alt="" /> | etc.)
</a>
---------
(function($) {
$(document).ready(function() {
$('a[href]').filter(function() {
return /\.(jpe?g|gif|png|bmp)\s*$/i.test(this.href);
}).fancybox({
'centerOnScroll' : false
});
});
})(jQuery);
Example 2: fire FancyBox for all thumbnail-linked images - like <a
href="image.jpg" alt=""><img src="thumb.jpg" alt="" /></a>
---------
(function($) {
$(document).ready(function() {
$('a[href]:has(img)').filter(function() {
return /\.(jpe?g|gif|png|bmp)\s*$/i.test(this.href);
}).fancybox({
'centerOnScroll' : false
});
});
})(jQuery);
Example 3: fire FancyBox for all thumbnail-linked images, and assign
empty rel to group these images in gallery.
---------
(function($) {
$.fn.add_rel_fancybox = function() {
this.filter(':has(img)').not('[rel]').attr('rel', 'fancybox');
return this;
}
$(document).ready(function() {
$('a[href]:has(img)').filter(function() {
return /\.(jpe?g|gif|png|bmp)\s*$/i.test(this.href);
}).add_rel_fancybox().fancybox({
'centerOnScroll' : false
});
});
})(jQuery);