Template:KU Leuven/Lightbox/Javascript
(function(root,factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){module.exports=factory(require('jquery'));}else{root.lightbox=factory(root.jQuery);}}(this,function($){function Lightbox(options){this.album=[];this.currentImageIndex=void 0;this.init();this.options=$.extend({},this.constructor.defaults);this.option(options);}
Lightbox.defaults={albumLabel:'Image %1 of %2',alwaysShowNavOnTouchDevices:false,fadeDuration:500,fitImagesInViewport:true,positionFromTop:50,resizeDuration:700,showImageNumberLabel:true,wrapAround:false};Lightbox.prototype.option=function(options){$.extend(this.options,options);};Lightbox.prototype.imageCountLabel=function(currentImageNum,totalImages){return this.options.albumLabel.replace(/%1/g,currentImageNum).replace(/%2/g,totalImages);};Lightbox.prototype.init=function(){this.enable();this.build();};Lightbox.prototype.enable=function(){var self=this;$('body').on('click','a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]',function(event){self.start($(event.currentTarget));return false;});};Lightbox.prototype.build=function(){var self=this;$('<img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" />
<a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a>
<a class="lb-cancel"></a>
<a class="lb-close"></a>