simplelightbox
Advanced tools
Comparing version
{ | ||
"name": "simplelightbox", | ||
"version": "1.15.0", | ||
"version": "1.15.1", | ||
"homepage": "http://andreknieriem.de/simple-lightbox", | ||
@@ -5,0 +5,0 @@ "authors": [ |
/* | ||
By André Rinas, www.andrerinas.de | ||
Available for use under the MIT License | ||
1.15.0 | ||
1.15.1 | ||
*/ | ||
@@ -152,2 +152,3 @@ ;( function( $, window, document, undefined ) | ||
index = 0, | ||
startIndex = 0, | ||
caption = $('<div>').addClass('sl-caption '+options.captionClass+' pos-'+options.captionPosition), | ||
@@ -213,6 +214,11 @@ image = $('<div>').addClass('sl-image'), | ||
spinner.hide(); | ||
var dirDefinined = (dir == 1 || dir == -1); | ||
if(startIndex === index && dirDefinined){ | ||
close(); | ||
return; | ||
} | ||
if(options.alertError){ | ||
alert(options.alertErrorMessage); | ||
} | ||
if(dir == 1 || dir == -1){ | ||
if(dirDefinined){ | ||
loadImage(dir); | ||
@@ -511,3 +517,5 @@ } else { | ||
if(animating) return false; | ||
openImage($(this)); | ||
var elem = $(this); | ||
startIndex = objects.index(elem); | ||
openImage(elem); | ||
} | ||
@@ -560,2 +568,3 @@ }); | ||
elem = elem || $(this[0]); | ||
startIndex = objects.index(elem); | ||
openImage(elem); | ||
@@ -562,0 +571,0 @@ }; |
/* | ||
By André Rinas, www.andrerinas.de | ||
Available for use under the MIT License | ||
1.15.0 | ||
1.15.1 | ||
*/ | ||
!function(X,N,Y,t){"use strict";X.fn.simpleLightbox=function(p){p=X.extend({sourceAttr:"href",overlay:!0,spinner:!0,nav:!0,navText:["‹","›"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",captionClass:"",close:!0,closeText:"×",swipeClose:!0,showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSlide:!0,animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,rel:!1,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9,scaleImageToRatio:!1,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1,history:!0,throttleInterval:0},p),N.navigator.pointerEnabled||N.navigator.msPointerEnabled;var d,t,r=0,l=0,h=X(),i=function(){var t=Y.body||Y.documentElement;return""===(t=t.style).WebkitTransition?"-webkit-":""===t.MozTransition?"-moz-":""===t.OTransition?"-o-":""===t.transition&&""},g=!1,u=[],f=p.rel&&!1!==p.rel?(t=p.rel,X(this).filter(function(){return X(this).attr("rel")===t})):this,m=(i=i(),0),v=!1!==i,n="pushState"in history,x=!1,a=N.location,c=function(){return a.hash.substring(1)},b=c(),y=function(){c();var t="pid="+(I+1),e=a.href.split("#")[0]+"#"+t;n?history[x?"replaceState":"pushState"]("",Y.title,e):x?a.replace(e):a.hash=t,x=!0},w=function(e,n){var i;return function(){var t=arguments;i||(e.apply(this,t),i=!0,setTimeout(function(){return i=!1},n))}},T="simplelb",e=X("<div>").addClass("sl-overlay"),o=X("<button>").addClass("sl-close").html(p.closeText),E=X("<div>").addClass("sl-spinner").html("<div></div>"),C=X("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+p.navText[0]+'</button><button class="sl-next">'+p.navText[1]+"</button>"),s=X("<div>").addClass("sl-counter").html('<span class="sl-current"></span>/<span class="sl-total"></span>'),S=!1,I=0,k=X("<div>").addClass("sl-caption "+p.captionClass+" pos-"+p.captionPosition),q=X("<div>").addClass("sl-image"),D=X("<div>").addClass("sl-wrapper").addClass(p.className),M=function(t){t.trigger(X.Event("show.simplelightbox")),p.disableScroll&&(m=L("hide")),D.appendTo("body"),q.appendTo(D),p.overlay&&e.appendTo(X("body")),S=!0,I=f.index(t),h=X("<img/>").hide().attr("src",t.attr(p.sourceAttr)),-1==u.indexOf(t.attr(p.sourceAttr))&&u.push(t.attr(p.sourceAttr)),q.html("").attr("style",""),h.appendTo(q),W(),e.fadeIn("fast"),X(".sl-close").fadeIn("fast"),E.show(),C.fadeIn("fast"),X(".sl-wrapper .sl-counter .sl-current").text(I+1),s.fadeIn("fast"),R(),p.preloading&&P(),setTimeout(function(){t.trigger(X.Event("shown.simplelightbox"))},p.animationSpeed)},R=function(s){if(h.length){var r=new Image,l=N.innerWidth*p.widthRatio,c=N.innerHeight*p.heightRatio;r.src=h.attr("src"),X(r).on("error",function(t){f.eq(I).trigger(X.Event("error.simplelightbox")),g=!(S=!1),E.hide(),p.alertError&&alert(p.alertErrorMessage),z(1==s||-1==s?s:1)}),r.onload=function(){void 0!==s&&f.eq(I).trigger(X.Event("changed.simplelightbox")).trigger(X.Event((1===s?"nextDone":"prevDone")+".simplelightbox")),p.history&&(x?d=setTimeout(y,800):y()),-1==u.indexOf(h.attr("src"))&&u.push(h.attr("src"));var t=r.width,e=r.height;if(p.scaleImageToRatio||l<t||c<e){var n=l/c<t/e?t/l:e/c;t/=n,e/=n}X(".sl-image").css({top:(N.innerHeight-e)/2+"px",left:(N.innerWidth-t-m)/2+"px"}),E.hide(),h.css({width:t+"px",height:e+"px"}).fadeIn("fast"),g=!0;var i,a="self"==p.captionSelector?f.eq(I):f.eq(I).find(p.captionSelector);if(i="data"==p.captionType?a.data(p.captionsData):"text"==p.captionType?a.html():a.prop(p.captionsData),p.loop||(0===I&&X(".sl-prev").hide(),I>=f.length-1&&X(".sl-next").hide(),0<I&&X(".sl-prev").show(),I<f.length-1&&X(".sl-next").show()),1==f.length&&X(".sl-prev, .sl-next").hide(),1==s||-1==s){var o={opacity:1};p.animationSlide&&(v?(O(0,100*s+"px"),setTimeout(function(){O(p.animationSpeed/1e3,"0px")},50)):o.left=parseInt(X(".sl-image").css("left"))+100*s+"px"),X(".sl-image").animate(o,p.animationSpeed,function(){S=!1,A(i,t)})}else S=!1,A(i,t);p.additionalHtml&&0===X(".sl-additional-html").length&&X("<div>").html(p.additionalHtml).addClass("sl-additional-html").appendTo(X(".sl-image"))}}},A=function(t,e){""!==t&&void 0!==t&&p.captions&&k.html(t).css({width:e+"px"}).hide().appendTo(X(".sl-image")).delay(p.captionDelay).fadeIn("fast")},O=function(t,e){var n={};n[i+"transform"]="translateX("+e+")",n[i+"transition"]=i+"transform "+t+"s linear",X(".sl-image").css(n)},W=function(){X(N).on("resize."+T,R),X(Y).on("click."+T+" touchstart."+T,".sl-close",function(t){t.preventDefault(),g&&H()}),p.history&&setTimeout(function(){X(N).on("hashchange."+T,function(){g&&c()===b&&H()})},40),C.on("click."+T,"button",w(function(t){t.preventDefault(),r=0,z(X(this).hasClass("sl-next")?1:-1)},p.throttleInterval));var e=0,n=0,i=0,a=0,o=!1,s=0;q.on("touchstart."+T+" mousedown."+T,function(t){return!!o||(v&&(s=parseInt(q.css("left"))),o=!0,l=r=0,e=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,i=t.originalEvent.pageY||t.originalEvent.touches[0].pageY,!1)}).on("touchmove."+T+" mousemove."+T+" pointermove MSPointerMove",function(t){if(!o)return!0;t.preventDefault(),n=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,a=t.originalEvent.pageY||t.originalEvent.touches[0].pageY,r=e-n,l=i-a,p.animationSlide&&(v?O(0,-r+"px"):q.css("left",s-r+"px"))}).on("touchend."+T+" mouseup."+T+" touchcancel."+T+" mouseleave."+T+" pointerup pointercancel MSPointerUp MSPointerCancel",function(t){if(o){var e=!(o=!1);p.loop||(0===I&&r<0&&(e=!1),I>=f.length-1&&0<r&&(e=!1)),Math.abs(r)>p.swipeTolerance&&e?z(0<r?1:-1):p.animationSlide&&(v?O(p.animationSpeed/1e3,"0px"):q.animate({left:s+"px"},p.animationSpeed/2)),p.swipeClose&&50<Math.abs(l)&&Math.abs(r)<p.swipeTolerance&&H()}})},P=function(){var t=I+1<0?f.length-1:I+1>=f.length-1?0:I+1,e=I-1<0?f.length-1:I-1>=f.length-1?0:I-1;X("<img />").attr("src",f.eq(t).attr(p.sourceAttr)).on("load",function(){-1==u.indexOf(X(this).attr("src"))&&u.push(X(this).attr("src")),f.eq(I).trigger(X.Event("nextImageLoaded.simplelightbox"))}),X("<img />").attr("src",f.eq(e).attr(p.sourceAttr)).on("load",function(){-1==u.indexOf(X(this).attr("src"))&&u.push(X(this).attr("src")),f.eq(I).trigger(X.Event("prevImageLoaded.simplelightbox"))})},z=function(e){f.eq(I).trigger(X.Event("change.simplelightbox")).trigger(X.Event((1===e?"next":"prev")+".simplelightbox"));var t=I+e;if(!(S||(t<0||t>=f.length)&&!1===p.loop)){I=t<0?f.length-1:t>f.length-1?0:t,X(".sl-wrapper .sl-counter .sl-current").text(I+1);var n={opacity:0};p.animationSlide&&(v?O(p.animationSpeed/1e3,-100*e-r+"px"):n.left=parseInt(X(".sl-image").css("left"))+-100*e+"px"),X(".sl-image").animate(n,p.animationSpeed,function(){setTimeout(function(){var t=f.eq(I);h.attr("src",t.attr(p.sourceAttr)),-1==u.indexOf(t.attr(p.sourceAttr))&&E.show(),X(".sl-caption").remove(),R(e),p.preloading&&P()},100)})}},H=function(){if(!S){var t=f.eq(I),e=!1;t.trigger(X.Event("close.simplelightbox")),p.history&&(n?history.pushState("",Y.title,a.pathname+a.search):a.hash="",clearTimeout(d)),X(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){p.disableScroll&&L("show"),X(".sl-wrapper, .sl-overlay").remove(),C.off("click","button"),X(Y).off("click."+T,".sl-close"),X(N).off("resize."+T),X(N).off("hashchange."+T),e||t.trigger(X.Event("closed.simplelightbox")),e=!0}),h=X(),S=g=!1}},L=function(t){var e=0;if("hide"==t){var n=N.innerWidth;if(!n){var i=Y.documentElement.getBoundingClientRect();n=i.right-Math.abs(i.left)}if(Y.body.clientWidth<n){var a=Y.createElement("div"),o=parseInt(X("body").css("padding-right"),10);a.className="sl-scrollbar-measure",X("body").append(a),e=a.offsetWidth-a.clientWidth,X(Y.body)[0].removeChild(a),X("body").data("padding",o),0<e&&X("body").addClass("hidden-scroll").css({"padding-right":o+e})}}else X("body").removeClass("hidden-scroll").css({"padding-right":X("body").data("padding")});return e};return p.close&&o.appendTo(D),p.showCounter&&1<f.length&&(s.appendTo(D),s.find(".sl-total").text(f.length)),p.nav&&C.appendTo(D),p.spinner&&E.appendTo(D),f.on("click."+T,function(t){if(function(t){if(!p.fileExt)return!0;var e=X(t).attr(p.sourceAttr).match(/\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/gim);return e&&"a"==X(t).prop("tagName").toLowerCase()&&new RegExp(".("+p.fileExt+")$","i").test(e)}(this)){if(t.preventDefault(),S)return!1;M(X(this))}}),X(Y).on("click."+T+" touchstart."+T,function(t){g&&p.docClose&&0===X(t.target).closest(".sl-image").length&&0===X(t.target).closest(".sl-navigation").length&&H()}),p.disableRightClick&&X(Y).on("contextmenu",".sl-image img",function(t){return!1}),p.enableKeyboard&&X(Y).on("keyup."+T,w(function(t){r=0;var e=t.keyCode;S&&27==e&&(h.attr("src",""),S=!1,H()),g&&(t.preventDefault(),27==e&&H(),37!=e&&39!=t.keyCode||z(39==t.keyCode?1:-1))},p.throttleInterval)),this.open=function(t){t=t||X(this[0]),M(t)},this.next=function(){z(1)},this.prev=function(){z(-1)},this.close=function(){H()},this.destroy=function(){X(Y).off("click."+T).off("keyup."+T),H(),X(".sl-overlay, .sl-wrapper").remove(),this.off("click")},this.refresh=function(){this.destroy(),X(this).simpleLightbox(p)},this}}(jQuery,window,document); | ||
!function(N,Y,j,t){"use strict";N.fn.simpleLightbox=function(d){d=N.extend({sourceAttr:"href",overlay:!0,spinner:!0,nav:!0,navText:["‹","›"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",captionClass:"",close:!0,closeText:"×",swipeClose:!0,showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSlide:!0,animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,rel:!1,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9,scaleImageToRatio:!1,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1,history:!0,throttleInterval:0},d),Y.navigator.pointerEnabled||Y.navigator.msPointerEnabled;var p,t,r=0,l=0,h=N(),i=function(){var t=j.body||j.documentElement;return""===(t=t.style).WebkitTransition?"-webkit-":""===t.MozTransition?"-moz-":""===t.OTransition?"-o-":""===t.transition&&""},g=!1,u=[],f=d.rel&&!1!==d.rel?(t=d.rel,N(this).filter(function(){return N(this).attr("rel")===t})):this,m=(i=i(),0),v=!1!==i,n="pushState"in history,x=!1,a=Y.location,c=function(){return a.hash.substring(1)},b=c(),y=function(){c();var t="pid="+(I+1),e=a.href.split("#")[0]+"#"+t;n?history[x?"replaceState":"pushState"]("",j.title,e):x?a.replace(e):a.hash=t,x=!0},w=function(e,n){var i;return function(){var t=arguments;i||(e.apply(this,t),i=!0,setTimeout(function(){return i=!1},n))}},T="simplelb",e=N("<div>").addClass("sl-overlay"),o=N("<button>").addClass("sl-close").html(d.closeText),E=N("<div>").addClass("sl-spinner").html("<div></div>"),C=N("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+d.navText[0]+'</button><button class="sl-next">'+d.navText[1]+"</button>"),s=N("<div>").addClass("sl-counter").html('<span class="sl-current"></span>/<span class="sl-total"></span>'),S=!1,I=0,k=0,q=N("<div>").addClass("sl-caption "+d.captionClass+" pos-"+d.captionPosition),D=N("<div>").addClass("sl-image"),M=N("<div>").addClass("sl-wrapper").addClass(d.className),R=function(t){t.trigger(N.Event("show.simplelightbox")),d.disableScroll&&(m=X("hide")),M.appendTo("body"),D.appendTo(M),d.overlay&&e.appendTo(N("body")),S=!0,I=f.index(t),h=N("<img/>").hide().attr("src",t.attr(d.sourceAttr)),-1==u.indexOf(t.attr(d.sourceAttr))&&u.push(t.attr(d.sourceAttr)),D.html("").attr("style",""),h.appendTo(D),P(),e.fadeIn("fast"),N(".sl-close").fadeIn("fast"),E.show(),C.fadeIn("fast"),N(".sl-wrapper .sl-counter .sl-current").text(I+1),s.fadeIn("fast"),A(),d.preloading&&z(),setTimeout(function(){t.trigger(N.Event("shown.simplelightbox"))},d.animationSpeed)},A=function(s){if(h.length){var r=new Image,l=Y.innerWidth*d.widthRatio,c=Y.innerHeight*d.heightRatio;r.src=h.attr("src"),N(r).on("error",function(t){f.eq(I).trigger(N.Event("error.simplelightbox")),g=!(S=!1),E.hide();var e=1==s||-1==s;k===I&&e?L():(d.alertError&&alert(d.alertErrorMessage),H(e?s:1))}),r.onload=function(){void 0!==s&&f.eq(I).trigger(N.Event("changed.simplelightbox")).trigger(N.Event((1===s?"nextDone":"prevDone")+".simplelightbox")),d.history&&(x?p=setTimeout(y,800):y()),-1==u.indexOf(h.attr("src"))&&u.push(h.attr("src"));var t=r.width,e=r.height;if(d.scaleImageToRatio||l<t||c<e){var n=l/c<t/e?t/l:e/c;t/=n,e/=n}N(".sl-image").css({top:(Y.innerHeight-e)/2+"px",left:(Y.innerWidth-t-m)/2+"px"}),E.hide(),h.css({width:t+"px",height:e+"px"}).fadeIn("fast"),g=!0;var i,a="self"==d.captionSelector?f.eq(I):f.eq(I).find(d.captionSelector);if(i="data"==d.captionType?a.data(d.captionsData):"text"==d.captionType?a.html():a.prop(d.captionsData),d.loop||(0===I&&N(".sl-prev").hide(),I>=f.length-1&&N(".sl-next").hide(),0<I&&N(".sl-prev").show(),I<f.length-1&&N(".sl-next").show()),1==f.length&&N(".sl-prev, .sl-next").hide(),1==s||-1==s){var o={opacity:1};d.animationSlide&&(v?(W(0,100*s+"px"),setTimeout(function(){W(d.animationSpeed/1e3,"0px")},50)):o.left=parseInt(N(".sl-image").css("left"))+100*s+"px"),N(".sl-image").animate(o,d.animationSpeed,function(){S=!1,O(i,t)})}else S=!1,O(i,t);d.additionalHtml&&0===N(".sl-additional-html").length&&N("<div>").html(d.additionalHtml).addClass("sl-additional-html").appendTo(N(".sl-image"))}}},O=function(t,e){""!==t&&void 0!==t&&d.captions&&q.html(t).css({width:e+"px"}).hide().appendTo(N(".sl-image")).delay(d.captionDelay).fadeIn("fast")},W=function(t,e){var n={};n[i+"transform"]="translateX("+e+")",n[i+"transition"]=i+"transform "+t+"s linear",N(".sl-image").css(n)},P=function(){N(Y).on("resize."+T,A),N(j).on("click."+T+" touchstart."+T,".sl-close",function(t){t.preventDefault(),g&&L()}),d.history&&setTimeout(function(){N(Y).on("hashchange."+T,function(){g&&c()===b&&L()})},40),C.on("click."+T,"button",w(function(t){t.preventDefault(),r=0,H(N(this).hasClass("sl-next")?1:-1)},d.throttleInterval));var e=0,n=0,i=0,a=0,o=!1,s=0;D.on("touchstart."+T+" mousedown."+T,function(t){return!!o||(v&&(s=parseInt(D.css("left"))),o=!0,l=r=0,e=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,i=t.originalEvent.pageY||t.originalEvent.touches[0].pageY,!1)}).on("touchmove."+T+" mousemove."+T+" pointermove MSPointerMove",function(t){if(!o)return!0;t.preventDefault(),n=t.originalEvent.pageX||t.originalEvent.touches[0].pageX,a=t.originalEvent.pageY||t.originalEvent.touches[0].pageY,r=e-n,l=i-a,d.animationSlide&&(v?W(0,-r+"px"):D.css("left",s-r+"px"))}).on("touchend."+T+" mouseup."+T+" touchcancel."+T+" mouseleave."+T+" pointerup pointercancel MSPointerUp MSPointerCancel",function(t){if(o){var e=!(o=!1);d.loop||(0===I&&r<0&&(e=!1),I>=f.length-1&&0<r&&(e=!1)),Math.abs(r)>d.swipeTolerance&&e?H(0<r?1:-1):d.animationSlide&&(v?W(d.animationSpeed/1e3,"0px"):D.animate({left:s+"px"},d.animationSpeed/2)),d.swipeClose&&50<Math.abs(l)&&Math.abs(r)<d.swipeTolerance&&L()}})},z=function(){var t=I+1<0?f.length-1:I+1>=f.length-1?0:I+1,e=I-1<0?f.length-1:I-1>=f.length-1?0:I-1;N("<img />").attr("src",f.eq(t).attr(d.sourceAttr)).on("load",function(){-1==u.indexOf(N(this).attr("src"))&&u.push(N(this).attr("src")),f.eq(I).trigger(N.Event("nextImageLoaded.simplelightbox"))}),N("<img />").attr("src",f.eq(e).attr(d.sourceAttr)).on("load",function(){-1==u.indexOf(N(this).attr("src"))&&u.push(N(this).attr("src")),f.eq(I).trigger(N.Event("prevImageLoaded.simplelightbox"))})},H=function(e){f.eq(I).trigger(N.Event("change.simplelightbox")).trigger(N.Event((1===e?"next":"prev")+".simplelightbox"));var t=I+e;if(!(S||(t<0||t>=f.length)&&!1===d.loop)){I=t<0?f.length-1:t>f.length-1?0:t,N(".sl-wrapper .sl-counter .sl-current").text(I+1);var n={opacity:0};d.animationSlide&&(v?W(d.animationSpeed/1e3,-100*e-r+"px"):n.left=parseInt(N(".sl-image").css("left"))+-100*e+"px"),N(".sl-image").animate(n,d.animationSpeed,function(){setTimeout(function(){var t=f.eq(I);h.attr("src",t.attr(d.sourceAttr)),-1==u.indexOf(t.attr(d.sourceAttr))&&E.show(),N(".sl-caption").remove(),A(e),d.preloading&&z()},100)})}},L=function(){if(!S){var t=f.eq(I),e=!1;t.trigger(N.Event("close.simplelightbox")),d.history&&(n?history.pushState("",j.title,a.pathname+a.search):a.hash="",clearTimeout(p)),N(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){d.disableScroll&&X("show"),N(".sl-wrapper, .sl-overlay").remove(),C.off("click","button"),N(j).off("click."+T,".sl-close"),N(Y).off("resize."+T),N(Y).off("hashchange."+T),e||t.trigger(N.Event("closed.simplelightbox")),e=!0}),h=N(),S=g=!1}},X=function(t){var e=0;if("hide"==t){var n=Y.innerWidth;if(!n){var i=j.documentElement.getBoundingClientRect();n=i.right-Math.abs(i.left)}if(j.body.clientWidth<n){var a=j.createElement("div"),o=parseInt(N("body").css("padding-right"),10);a.className="sl-scrollbar-measure",N("body").append(a),e=a.offsetWidth-a.clientWidth,N(j.body)[0].removeChild(a),N("body").data("padding",o),0<e&&N("body").addClass("hidden-scroll").css({"padding-right":o+e})}}else N("body").removeClass("hidden-scroll").css({"padding-right":N("body").data("padding")});return e};return d.close&&o.appendTo(M),d.showCounter&&1<f.length&&(s.appendTo(M),s.find(".sl-total").text(f.length)),d.nav&&C.appendTo(M),d.spinner&&E.appendTo(M),f.on("click."+T,function(t){if(function(t){if(!d.fileExt)return!0;var e=N(t).attr(d.sourceAttr).match(/\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/gim);return e&&"a"==N(t).prop("tagName").toLowerCase()&&new RegExp(".("+d.fileExt+")$","i").test(e)}(this)){if(t.preventDefault(),S)return!1;var e=N(this);k=f.index(e),R(e)}}),N(j).on("click."+T+" touchstart."+T,function(t){g&&d.docClose&&0===N(t.target).closest(".sl-image").length&&0===N(t.target).closest(".sl-navigation").length&&L()}),d.disableRightClick&&N(j).on("contextmenu",".sl-image img",function(t){return!1}),d.enableKeyboard&&N(j).on("keyup."+T,w(function(t){r=0;var e=t.keyCode;S&&27==e&&(h.attr("src",""),S=!1,L()),g&&(t.preventDefault(),27==e&&L(),37!=e&&39!=t.keyCode||H(39==t.keyCode?1:-1))},d.throttleInterval)),this.open=function(t){t=t||N(this[0]),k=f.index(t),R(t)},this.next=function(){H(1)},this.prev=function(){H(-1)},this.close=function(){L()},this.destroy=function(){N(j).off("click."+T).off("keyup."+T),L(),N(".sl-overlay, .sl-wrapper").remove(),this.off("click")},this.refresh=function(){this.destroy(),N(this).simpleLightbox(d)},this}}(jQuery,window,document); |
{ | ||
"name": "simplelightbox", | ||
"version": "1.15.0", | ||
"version": "1.15.1", | ||
"description": "Touch-friendly image lightbox for mobile and desktop with jQuery", | ||
"main": "dist/simple-lightbox.js", | ||
"style": "dist/simplelightbox.scss", | ||
"repository": { | ||
@@ -7,0 +8,0 @@ "type": "git", |
@@ -159,2 +159,4 @@ # simplelightbox | ||
$sl-iframe-border-large: 0 none; | ||
$add-vendor-prefixes: true !default; | ||
``` | ||
@@ -164,2 +166,3 @@ | ||
### Changelog | ||
**1.15.1 - Merged pull request #113,#114,#115 - Thanks to RaphaelHaettich and celsius-jochen** | ||
**1.15.0 - Merged pull request #111, fixed #101 and added possibility to close lightbox on load #74** | ||
@@ -218,3 +221,4 @@ **1.14.0 - Merged pull request #107 and #108. Thanks to RaphaelHaettich** | ||
[Geoffrey Crofte](http://geoffrey.crofte.fr/) - [Github](https://github.com/creativejuiz/) | ||
[Karl Anders](http://webseiten-anders.de/) - [Github](https://github.com/karland/) | ||
[Raphael Hättich](https://github.com/RaphaelHaettich) | ||
[Karl Anders](http://webseiten-anders.de/) - [Github](https://github.com/karland/) | ||
[Raphael Hättich](https://github.com/RaphaelHaettich) | ||
[Jochen Sengier](https://www.celcius.be) - [Github](https://github.com/celcius-jochen/) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7338580
0.01%998
0.91%222
1.83%