$(document).ready(function() { /* * simple image gallery. uses default settings */ $('.fancybox').fancybox(); /* * different effects */ // change title type, overlay closing speed $(".fancybox-effects-a").fancybox({ helpers: { title : { type : 'outside' }, overlay : { speedout : 0 } } }); // disable opening and closing animations, change title type $(".fancybox-effects-b").fancybox({ openeffect : 'none', closeeffect : 'none', helpers : { title : { type : 'over' } } }); // set custom style, close if clicked, change title type and overlay color $(".fancybox-effects-c").fancybox({ wrapcss : 'fancybox-custom', closeclick : true, openeffect : 'none', helpers : { title : { type : 'inside' }, overlay : { css : { 'background' : 'rgba(238,238,238,0.85)' } } } }); // remove padding, set opening and closing animations, close if clicked and disable overlay $(".fancybox-effects-d").fancybox({ padding: 0, openeffect : 'elastic', openspeed : 150, closeeffect : 'elastic', closespeed : 150, closeclick : true, helpers : { overlay : null } }); /* * button helper. disable animations, hide close button, change title type and content */ $('.fancybox-buttons').fancybox({ openeffect : 'none', closeeffect : 'none', preveffect : 'none', nexteffect : 'none', closebtn : false, helpers : { title : { type : 'inside' }, buttons : {} }, afterload : function() { this.title = 'image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); } }); /* * thumbnail helper. disable animations, hide close button, arrows and slide to next gallery item if clicked */ $('.fancybox-thumbs').fancybox({ preveffect : 'none', nexteffect : 'none', closebtn : false, arrows : false, nextclick : true, helpers : { thumbs : { width : 50, height : 50 } } }); /* * media helper. group items, disable animations, hide arrows, enable media and button helpers. */ $('.fancybox-media') .attr('rel', 'media-gallery') .fancybox({ openeffect : 'none', closeeffect : 'none', preveffect : 'none', nexteffect : 'none', arrows : false, helpers : { media : {}, buttons : {} } }); /* * open manually */ $("#fancybox-manual-a").click(function() { $.fancybox.open('1_b.jpg'); }); $("#fancybox-manual-b").click(function() { $.fancybox.open({ href : 'iframe.html', type : 'iframe', padding : 5 }); }); $("#fancybox-manual-c").click(function() { $.fancybox.open([ { href : '1_b.jpg', title : 'my title' }, { href : '2_b.jpg', title : '2nd title' }, { href : '3_b.jpg' } ], { helpers : { thumbs : { width: 75, height: 50 } } }); }); });