Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simplelightbox

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplelightbox - npm Package Compare versions

Comparing version 1.10.2 to 1.10.3

2

bower.json
{
"name": "simplelightbox",
"version": "1.10.2",
"version": "1.10.3",
"homepage": "http://andreknieriem.de/simple-lightbox",

@@ -5,0 +5,0 @@ "authors": [

@@ -67,7 +67,8 @@

transPrefix = function(){
var s = document.body || document.documentElement, s = s.style;
if( s.WebkitTransition == '' ) return '-webkit-';
if( s.MozTransition == '' ) return '-moz-';
if( s.OTransition == '' ) return '-o-';
if( s.transition == '' ) return '';
var s = document.body || document.documentElement;
s = s.style;
if( s.WebkitTransition === '' ) return '-webkit-';
if( s.MozTransition === '' ) return '-moz-';
if( s.OTransition === '' ) return '-o-';
if( s.transition === '' ) return '';
return false;

@@ -85,2 +86,3 @@ },

transPrefix = transPrefix(),
globalScrollbarwidth = 0,
canTransisions = (transPrefix !== false) ? true : false,

@@ -155,3 +157,3 @@ supportsPushState = ('pushState' in history),

elem.trigger($.Event('show.simplelightbox'));
if(options.disableScroll) handleScrollbar('hide');
if(options.disableScroll) globalScrollbarwidth = handleScrollbar('hide');
wrapper.appendTo('body');

@@ -190,3 +192,3 @@ image.appendTo(wrapper);

//no image was found
objects.eq(index).trigger($.Event('error.simplelightbox'))
objects.eq(index).trigger($.Event('error.simplelightbox'));
animating = false;

@@ -233,3 +235,3 @@ opened = true;

'top': ( $( window ).height() - imageHeight ) / 2 + 'px',
'left': ( $( window ).width() - imageWidth ) / 2 + 'px'
'left': ( $( window ).width() - imageWidth - globalScrollbarwidth)/ 2 + 'px'
});

@@ -245,12 +247,13 @@ spinner.hide();

var cSel = (options.captionSelector == 'self') ? objects.eq(index) : objects.eq(index).find(options.captionSelector);
var captionText;
if(options.captionType == 'data'){
var captionText = cSel.data(options.captionsData);
captionText = cSel.data(options.captionsData);
} else if(options.captionType == 'text'){
var captionText = cSel.html();
captionText = cSel.html();
} else {
var captionText = cSel.prop(options.captionsData);
captionText = cSel.prop(options.captionsData);
}
if(!options.loop) {
if(index == 0){ $('.sl-prev').hide();}
if(index === 0){ $('.sl-prev').hide();}
if(index >= objects.length -1) {$('.sl-next').hide();}

@@ -283,9 +286,9 @@ if(index > 0){ $('.sl-prev').show(); }

}
if(options.additionalHtml && $('.sl-additional-html').length == 0){
if(options.additionalHtml && $('.sl-additional-html').length === 0){
$('<div>').html(options.additionalHtml).addClass('sl-additional-html').appendTo($('.sl-image'));
}
}
};
},
setCaption = function(captiontext){
if(captiontext != '' && typeof captiontext !== "undefined" && options.captions){
if(captiontext !== '' && typeof captiontext !== "undefined" && options.captions){
caption.html(captiontext).hide().appendTo($('.sl-image')).delay(options.captionDelay).fadeIn('fast');

@@ -367,3 +370,3 @@ }

if(!options.loop) {
if(index == 0 && swipeDiff < 0){ possibleDir = false; }
if(index === 0 && swipeDiff < 0){ possibleDir = false; }
if(index >= objects.length -1 && swipeDiff > 0) { possibleDir = false; }

@@ -415,3 +418,3 @@ }

var newIndex = index + dir;
if(animating || (newIndex < 0 || newIndex >= objects.length) && options.loop == false ) return;
if(animating || (newIndex < 0 || newIndex >= objects.length) && options.loop === false ) return;
index = (newIndex < 0) ? objects.length -1: (newIndex > objects.length -1) ? 0 : newIndex;

@@ -459,7 +462,8 @@ $('.sl-wrapper .sl-counter .sl-current').text(index +1);

handleScrollbar = function(type){
var scrollbarWidth = 0;
if(type == 'hide'){
var fullWindowWidth = window.innerWidth;
if (!fullWindowWidth) {
var documentElementRect = document.documentElement.getBoundingClientRect()
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
var documentElementRect = document.documentElement.getBoundingClientRect();
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
}

@@ -471,3 +475,3 @@ if(document.body.clientWidth < fullWindowWidth){

$('body').append(scrollDiv);
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
$(document.body)[0].removeChild(scrollDiv);

@@ -482,3 +486,4 @@ $('body').data('padding',padding);

}
}
return scrollbarWidth;
};

@@ -500,3 +505,3 @@ // events

if(opened){
if((options.docClose && $(e.target).closest('.sl-image').length == 0 && $(e.target).closest('.sl-navigation').length == 0)){
if((options.docClose && $(e.target).closest('.sl-image').length === 0 && $(e.target).closest('.sl-navigation').length === 0)){
close();

@@ -537,15 +542,15 @@ }

openImage(elem);
}
};
this.next = function(){
loadImage( 1 );
}
};
this.prev = function(){
loadImage( -1 );
}
};
this.close = function(){
close();
}
};

@@ -557,3 +562,3 @@ this.destroy = function(){

this.off('click');
}
};

@@ -563,3 +568,3 @@ this.refresh = function(){

$(this.selector).simpleLightbox(options);
}
};

@@ -566,0 +571,0 @@ return this;

@@ -5,2 +5,2 @@ /*

*/
!function(a,b,c,d){"use strict";a.fn.simpleLightbox=function(d){var s,d=a.extend({overlay:!0,spinner:!0,nav:!0,navText:["&lsaquo;","&rsaquo;"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",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,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1,history:!0},d),h=(b.navigator.pointerEnabled||b.navigator.msPointerEnabled,0),i=0,j=a(),k=function(){var a=c.body||c.documentElement,a=a.style;return""==a.WebkitTransition?"-webkit-":""==a.MozTransition?"-moz-":""==a.OTransition?"-o-":""==a.transition&&""},l=!1,m=[],n=function(b,c){var d=a(c.selector).filter(function(){return a(this).attr("rel")===b});return d},o=d.rel&&d.rel!==!1?n(d.rel,this):this,k=k(),p=k!==!1,q="pushState"in history,r=!1,t=b.location,u=function(){return t.hash.substring(1)},v=u(),w=function(){var b=(u(),"pid="+(G+1)),d=t.href.split("#")[0]+"#"+b;q?history[r?"replaceState":"pushState"]("",c.title,d):r?t.replace(d):t.hash=b,r=!0},x=function(){q?history.pushState("",c.title,t.pathname+t.search):t.hash="",clearTimeout(s)},y=function(){r?s=setTimeout(w,800):w()},z="simplelb",A=a("<div>").addClass("sl-overlay"),B=a("<button>").addClass("sl-close").html(d.closeText),C=a("<div>").addClass("sl-spinner").html("<div></div>"),D=a("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+d.navText[0]+'</button><button class="sl-next">'+d.navText[1]+"</button>"),E=a("<div>").addClass("sl-counter").html('<span class="sl-current"></span>/<span class="sl-total"></span>'),F=!1,G=0,H=a("<div>").addClass("sl-caption pos-"+d.captionPosition),I=a("<div>").addClass("sl-image"),J=a("<div>").addClass("sl-wrapper").addClass(d.className),K=function(b){return!d.fileExt||"a"==a(b).prop("tagName").toLowerCase()&&new RegExp(".("+d.fileExt+")$","i").test(a(b).attr("href"))},L=function(){d.close&&B.appendTo(J),d.showCounter&&o.length>1&&(E.appendTo(J),E.find(".sl-total").text(o.length)),d.nav&&D.appendTo(J),d.spinner&&C.appendTo(J)},M=function(b){b.trigger(a.Event("show.simplelightbox")),d.disableScroll&&V("hide"),J.appendTo("body"),I.appendTo(J),d.overlay&&A.appendTo(a("body")),F=!0,G=o.index(b),j=a("<img/>").hide().attr("src",b.attr("href")),m.indexOf(b.attr("href"))==-1&&m.push(b.attr("href")),I.html("").attr("style",""),j.appendTo(I),Q(),A.fadeIn("fast"),a(".sl-close").fadeIn("fast"),C.show(),D.fadeIn("fast"),a(".sl-wrapper .sl-counter .sl-current").text(G+1),E.fadeIn("fast"),N(),d.preloading&&S(),setTimeout(function(){b.trigger(a.Event("shown.simplelightbox"))},d.animationSpeed)},N=function(c){if(j.length){var e=new Image,f=a(b).width()*d.widthRatio,g=a(b).height()*d.heightRatio;e.src=j.attr("src"),a(e).bind("error",function(b){o.eq(G).trigger(a.Event("error.simplelightbox")),F=!1,l=!0,C.hide(),d.alertError&&alert(d.alertErrorMessage),T(1==c||c==-1?c:1)}),e.onload=function(){"undefined"!=typeof c&&o.eq(G).trigger(a.Event("changed.simplelightbox")).trigger(a.Event((1===c?"nextDone":"prevDone")+".simplelightbox")),d.history&&y(),m.indexOf(j.attr("src"))==-1&&m.push(j.attr("src"));var h=e.width,i=e.height;if(h>f||i>g){var k=h/i>f/g?h/f:i/g;h/=k,i/=k}a(".sl-image").css({top:(a(b).height()-i)/2+"px",left:(a(b).width()-h)/2+"px"}),C.hide(),j.css({width:h+"px",height:i+"px"}).fadeIn("fast"),l=!0;var n="self"==d.captionSelector?o.eq(G):o.eq(G).find(d.captionSelector);if("data"==d.captionType)var q=n.data(d.captionsData);else if("text"==d.captionType)var q=n.html();else var q=n.prop(d.captionsData);if(d.loop||(0==G&&a(".sl-prev").hide(),G>=o.length-1&&a(".sl-next").hide(),G>0&&a(".sl-prev").show(),G<o.length-1&&a(".sl-next").show()),1==o.length&&a(".sl-prev, .sl-next").hide(),1==c||c==-1){var r={opacity:1};d.animationSlide&&(p?(P(0,100*c+"px"),setTimeout(function(){P(d.animationSpeed/1e3,"0px"),50})):r.left=parseInt(a(".sl-image").css("left"))+100*c+"px"),a(".sl-image").animate(r,d.animationSpeed,function(){F=!1,O(q)})}else F=!1,O(q);d.additionalHtml&&0==a(".sl-additional-html").length&&a("<div>").html(d.additionalHtml).addClass("sl-additional-html").appendTo(a(".sl-image"))}}},O=function(b){""!=b&&"undefined"!=typeof b&&d.captions&&H.html(b).hide().appendTo(a(".sl-image")).delay(d.captionDelay).fadeIn("fast")},P=function(b,c){var d={};d[k+"transform"]="translateX("+c+")",d[k+"transition"]=k+"transform "+b+"s linear",a(".sl-image").css(d)},Q=function(){a(b).on("resize."+z,N),a(c).on("click."+z+" touchstart."+z,".sl-close",function(a){a.preventDefault(),l&&U()}),d.history&&setTimeout(function(){a(b).on("hashchange."+z,function(){if(l&&u()===v)return void U()})},40),D.on("click."+z,"button",function(b){b.preventDefault(),h=0,T(a(this).hasClass("sl-next")?1:-1)});var e=0,f=0,g=0,j=0,k=!1,m=0;I.on("touchstart."+z+" mousedown."+z,function(a){return!!k||(p&&(m=parseInt(I.css("left"))),k=!0,e=a.originalEvent.pageX||a.originalEvent.touches[0].pageX,g=a.originalEvent.pageY||a.originalEvent.touches[0].pageY,!1)}).on("touchmove."+z+" mousemove."+z+" pointermove MSPointerMove",function(a){return!k||(a.preventDefault(),f=a.originalEvent.pageX||a.originalEvent.touches[0].pageX,j=a.originalEvent.pageY||a.originalEvent.touches[0].pageY,h=e-f,i=g-j,void(d.animationSlide&&(p?P(0,-h+"px"):I.css("left",m-h+"px"))))}).on("touchend."+z+" mouseup."+z+" touchcancel."+z+" mouseleave."+z+" pointerup pointercancel MSPointerUp MSPointerCancel",function(a){if(k){k=!1;var b=!0;d.loop||(0==G&&h<0&&(b=!1),G>=o.length-1&&h>0&&(b=!1)),Math.abs(h)>d.swipeTolerance&&b?T(h>0?1:-1):d.animationSlide&&(p?P(d.animationSpeed/1e3,"0px"):I.animate({left:m+"px"},d.animationSpeed/2)),d.swipeClose&&Math.abs(i)>50&&Math.abs(h)<d.swipeTolerance&&U()}})},R=function(){D.off("click","button"),a(c).off("click."+z,".sl-close"),a(b).off("resize."+z),a(b).off("hashchange."+z)},S=function(){var b=G+1<0?o.length-1:G+1>=o.length-1?0:G+1,c=G-1<0?o.length-1:G-1>=o.length-1?0:G-1;a("<img />").attr("src",o.eq(b).attr("href")).on("load",function(){m.indexOf(a(this).attr("src"))==-1&&m.push(a(this).attr("src")),o.eq(G).trigger(a.Event("nextImageLoaded.simplelightbox"))}),a("<img />").attr("src",o.eq(c).attr("href")).on("load",function(){m.indexOf(a(this).attr("src"))==-1&&m.push(a(this).attr("src")),o.eq(G).trigger(a.Event("prevImageLoaded.simplelightbox"))})},T=function(b){o.eq(G).trigger(a.Event("change.simplelightbox")).trigger(a.Event((1===b?"next":"prev")+".simplelightbox"));var c=G+b;if(!(F||(c<0||c>=o.length)&&0==d.loop)){G=c<0?o.length-1:c>o.length-1?0:c,a(".sl-wrapper .sl-counter .sl-current").text(G+1);var e={opacity:0};d.animationSlide&&(p?P(d.animationSpeed/1e3,-100*b-h+"px"):e.left=parseInt(a(".sl-image").css("left"))+-100*b+"px"),a(".sl-image").animate(e,d.animationSpeed,function(){setTimeout(function(){var c=o.eq(G);j.attr("src",c.attr("href")),m.indexOf(c.attr("href"))==-1&&C.show(),a(".sl-caption").remove(),N(b),d.preloading&&S()},100)})}},U=function(){if(!F){var b=o.eq(G),c=!1;b.trigger(a.Event("close.simplelightbox")),x(),a(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){d.disableScroll&&V("show"),a(".sl-wrapper, .sl-overlay").remove(),R(),c||b.trigger(a.Event("closed.simplelightbox")),c=!0}),j=a(),l=!1,F=!1}},V=function(d){if("hide"==d){var e=b.innerWidth;if(!e){var f=c.documentElement.getBoundingClientRect();e=f.right-Math.abs(f.left)}if(c.body.clientWidth<e){var g=c.createElement("div"),h=parseInt(a("body").css("padding-right"),10);g.className="sl-scrollbar-measure",a("body").append(g);var i=g.offsetWidth-g.clientWidth;a(c.body)[0].removeChild(g),a("body").data("padding",h),i>0&&a("body").addClass("hidden-scroll").css({"padding-right":h+i})}}else a("body").removeClass("hidden-scroll").css({"padding-right":a("body").data("padding")})};return L(),o.on("click."+z,function(b){if(K(this)){if(b.preventDefault(),F)return!1;M(a(this))}}),a(c).on("click."+z+" touchstart."+z,function(b){l&&d.docClose&&0==a(b.target).closest(".sl-image").length&&0==a(b.target).closest(".sl-navigation").length&&U()}),d.disableRightClick&&a(c).on("contextmenu",".sl-image img",function(a){return!1}),d.enableKeyboard&&a(c).on("keyup."+z,function(a){if(a.preventDefault(),h=0,l){var b=a.keyCode;27==b&&U(),37!=b&&39!=a.keyCode||T(39==a.keyCode?1:-1)}}),this.open=function(b){b=b||a(this[0]),M(b)},this.next=function(){T(1)},this.prev=function(){T(-1)},this.close=function(){U()},this.destroy=function(){a(c).unbind("click."+z).unbind("keyup."+z),U(),a(".sl-overlay, .sl-wrapper").remove(),this.off("click")},this.refresh=function(){this.destroy(),a(this.selector).simpleLightbox(d)},this}}(jQuery,window,document);
!function(a,b,c,d){"use strict";a.fn.simpleLightbox=function(d){var t,d=a.extend({overlay:!0,spinner:!0,nav:!0,navText:["&lsaquo;","&rsaquo;"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",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,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1,history:!0},d),h=(b.navigator.pointerEnabled||b.navigator.msPointerEnabled,0),i=0,j=a(),k=function(){var a=c.body||c.documentElement;return a=a.style,""===a.WebkitTransition?"-webkit-":""===a.MozTransition?"-moz-":""===a.OTransition?"-o-":""===a.transition&&""},l=!1,m=[],n=function(b,c){var d=a(c.selector).filter(function(){return a(this).attr("rel")===b});return d},o=d.rel&&d.rel!==!1?n(d.rel,this):this,k=k(),p=0,q=k!==!1,r="pushState"in history,s=!1,u=b.location,v=function(){return u.hash.substring(1)},w=v(),x=function(){var b=(v(),"pid="+(H+1)),d=u.href.split("#")[0]+"#"+b;r?history[s?"replaceState":"pushState"]("",c.title,d):s?u.replace(d):u.hash=b,s=!0},y=function(){r?history.pushState("",c.title,u.pathname+u.search):u.hash="",clearTimeout(t)},z=function(){s?t=setTimeout(x,800):x()},A="simplelb",B=a("<div>").addClass("sl-overlay"),C=a("<button>").addClass("sl-close").html(d.closeText),D=a("<div>").addClass("sl-spinner").html("<div></div>"),E=a("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+d.navText[0]+'</button><button class="sl-next">'+d.navText[1]+"</button>"),F=a("<div>").addClass("sl-counter").html('<span class="sl-current"></span>/<span class="sl-total"></span>'),G=!1,H=0,I=a("<div>").addClass("sl-caption pos-"+d.captionPosition),J=a("<div>").addClass("sl-image"),K=a("<div>").addClass("sl-wrapper").addClass(d.className),L=function(b){return!d.fileExt||"a"==a(b).prop("tagName").toLowerCase()&&new RegExp(".("+d.fileExt+")$","i").test(a(b).attr("href"))},M=function(){d.close&&C.appendTo(K),d.showCounter&&o.length>1&&(F.appendTo(K),F.find(".sl-total").text(o.length)),d.nav&&E.appendTo(K),d.spinner&&D.appendTo(K)},N=function(b){b.trigger(a.Event("show.simplelightbox")),d.disableScroll&&(p=W("hide")),K.appendTo("body"),J.appendTo(K),d.overlay&&B.appendTo(a("body")),G=!0,H=o.index(b),j=a("<img/>").hide().attr("src",b.attr("href")),m.indexOf(b.attr("href"))==-1&&m.push(b.attr("href")),J.html("").attr("style",""),j.appendTo(J),R(),B.fadeIn("fast"),a(".sl-close").fadeIn("fast"),D.show(),E.fadeIn("fast"),a(".sl-wrapper .sl-counter .sl-current").text(H+1),F.fadeIn("fast"),O(),d.preloading&&T(),setTimeout(function(){b.trigger(a.Event("shown.simplelightbox"))},d.animationSpeed)},O=function(c){if(j.length){var e=new Image,f=a(b).width()*d.widthRatio,g=a(b).height()*d.heightRatio;e.src=j.attr("src"),a(e).bind("error",function(b){o.eq(H).trigger(a.Event("error.simplelightbox")),G=!1,l=!0,D.hide(),d.alertError&&alert(d.alertErrorMessage),U(1==c||c==-1?c:1)}),e.onload=function(){"undefined"!=typeof c&&o.eq(H).trigger(a.Event("changed.simplelightbox")).trigger(a.Event((1===c?"nextDone":"prevDone")+".simplelightbox")),d.history&&z(),m.indexOf(j.attr("src"))==-1&&m.push(j.attr("src"));var h=e.width,i=e.height;if(h>f||i>g){var k=h/i>f/g?h/f:i/g;h/=k,i/=k}a(".sl-image").css({top:(a(b).height()-i)/2+"px",left:(a(b).width()-h-p)/2+"px"}),D.hide(),j.css({width:h+"px",height:i+"px"}).fadeIn("fast"),l=!0;var r,n="self"==d.captionSelector?o.eq(H):o.eq(H).find(d.captionSelector);if(r="data"==d.captionType?n.data(d.captionsData):"text"==d.captionType?n.html():n.prop(d.captionsData),d.loop||(0===H&&a(".sl-prev").hide(),H>=o.length-1&&a(".sl-next").hide(),H>0&&a(".sl-prev").show(),H<o.length-1&&a(".sl-next").show()),1==o.length&&a(".sl-prev, .sl-next").hide(),1==c||c==-1){var s={opacity:1};d.animationSlide&&(q?(Q(0,100*c+"px"),setTimeout(function(){Q(d.animationSpeed/1e3,"0px"),50})):s.left=parseInt(a(".sl-image").css("left"))+100*c+"px"),a(".sl-image").animate(s,d.animationSpeed,function(){G=!1,P(r)})}else G=!1,P(r);d.additionalHtml&&0===a(".sl-additional-html").length&&a("<div>").html(d.additionalHtml).addClass("sl-additional-html").appendTo(a(".sl-image"))}}},P=function(b){""!==b&&"undefined"!=typeof b&&d.captions&&I.html(b).hide().appendTo(a(".sl-image")).delay(d.captionDelay).fadeIn("fast")},Q=function(b,c){var d={};d[k+"transform"]="translateX("+c+")",d[k+"transition"]=k+"transform "+b+"s linear",a(".sl-image").css(d)},R=function(){a(b).on("resize."+A,O),a(c).on("click."+A+" touchstart."+A,".sl-close",function(a){a.preventDefault(),l&&V()}),d.history&&setTimeout(function(){a(b).on("hashchange."+A,function(){if(l&&v()===w)return void V()})},40),E.on("click."+A,"button",function(b){b.preventDefault(),h=0,U(a(this).hasClass("sl-next")?1:-1)});var e=0,f=0,g=0,j=0,k=!1,m=0;J.on("touchstart."+A+" mousedown."+A,function(a){return!!k||(q&&(m=parseInt(J.css("left"))),k=!0,e=a.originalEvent.pageX||a.originalEvent.touches[0].pageX,g=a.originalEvent.pageY||a.originalEvent.touches[0].pageY,!1)}).on("touchmove."+A+" mousemove."+A+" pointermove MSPointerMove",function(a){return!k||(a.preventDefault(),f=a.originalEvent.pageX||a.originalEvent.touches[0].pageX,j=a.originalEvent.pageY||a.originalEvent.touches[0].pageY,h=e-f,i=g-j,void(d.animationSlide&&(q?Q(0,-h+"px"):J.css("left",m-h+"px"))))}).on("touchend."+A+" mouseup."+A+" touchcancel."+A+" mouseleave."+A+" pointerup pointercancel MSPointerUp MSPointerCancel",function(a){if(k){k=!1;var b=!0;d.loop||(0===H&&h<0&&(b=!1),H>=o.length-1&&h>0&&(b=!1)),Math.abs(h)>d.swipeTolerance&&b?U(h>0?1:-1):d.animationSlide&&(q?Q(d.animationSpeed/1e3,"0px"):J.animate({left:m+"px"},d.animationSpeed/2)),d.swipeClose&&Math.abs(i)>50&&Math.abs(h)<d.swipeTolerance&&V()}})},S=function(){E.off("click","button"),a(c).off("click."+A,".sl-close"),a(b).off("resize."+A),a(b).off("hashchange."+A)},T=function(){var b=H+1<0?o.length-1:H+1>=o.length-1?0:H+1,c=H-1<0?o.length-1:H-1>=o.length-1?0:H-1;a("<img />").attr("src",o.eq(b).attr("href")).on("load",function(){m.indexOf(a(this).attr("src"))==-1&&m.push(a(this).attr("src")),o.eq(H).trigger(a.Event("nextImageLoaded.simplelightbox"))}),a("<img />").attr("src",o.eq(c).attr("href")).on("load",function(){m.indexOf(a(this).attr("src"))==-1&&m.push(a(this).attr("src")),o.eq(H).trigger(a.Event("prevImageLoaded.simplelightbox"))})},U=function(b){o.eq(H).trigger(a.Event("change.simplelightbox")).trigger(a.Event((1===b?"next":"prev")+".simplelightbox"));var c=H+b;if(!(G||(c<0||c>=o.length)&&d.loop===!1)){H=c<0?o.length-1:c>o.length-1?0:c,a(".sl-wrapper .sl-counter .sl-current").text(H+1);var e={opacity:0};d.animationSlide&&(q?Q(d.animationSpeed/1e3,-100*b-h+"px"):e.left=parseInt(a(".sl-image").css("left"))+-100*b+"px"),a(".sl-image").animate(e,d.animationSpeed,function(){setTimeout(function(){var c=o.eq(H);j.attr("src",c.attr("href")),m.indexOf(c.attr("href"))==-1&&D.show(),a(".sl-caption").remove(),O(b),d.preloading&&T()},100)})}},V=function(){if(!G){var b=o.eq(H),c=!1;b.trigger(a.Event("close.simplelightbox")),y(),a(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){d.disableScroll&&W("show"),a(".sl-wrapper, .sl-overlay").remove(),S(),c||b.trigger(a.Event("closed.simplelightbox")),c=!0}),j=a(),l=!1,G=!1}},W=function(d){var e=0;if("hide"==d){var f=b.innerWidth;if(!f){var g=c.documentElement.getBoundingClientRect();f=g.right-Math.abs(g.left)}if(c.body.clientWidth<f){var h=c.createElement("div"),i=parseInt(a("body").css("padding-right"),10);h.className="sl-scrollbar-measure",a("body").append(h),e=h.offsetWidth-h.clientWidth,a(c.body)[0].removeChild(h),a("body").data("padding",i),e>0&&a("body").addClass("hidden-scroll").css({"padding-right":i+e})}}else a("body").removeClass("hidden-scroll").css({"padding-right":a("body").data("padding")});return e};return M(),o.on("click."+A,function(b){if(L(this)){if(b.preventDefault(),G)return!1;N(a(this))}}),a(c).on("click."+A+" touchstart."+A,function(b){l&&d.docClose&&0===a(b.target).closest(".sl-image").length&&0===a(b.target).closest(".sl-navigation").length&&V()}),d.disableRightClick&&a(c).on("contextmenu",".sl-image img",function(a){return!1}),d.enableKeyboard&&a(c).on("keyup."+A,function(a){if(a.preventDefault(),h=0,l){var b=a.keyCode;27==b&&V(),37!=b&&39!=a.keyCode||U(39==a.keyCode?1:-1)}}),this.open=function(b){b=b||a(this[0]),N(b)},this.next=function(){U(1)},this.prev=function(){U(-1)},this.close=function(){V()},this.destroy=function(){a(c).unbind("click."+A).unbind("keyup."+A),V(),a(".sl-overlay, .sl-wrapper").remove(),this.off("click")},this.refresh=function(){this.destroy(),a(this.selector).simpleLightbox(d)},this}}(jQuery,window,document);
{
"name": "simplelightbox",
"version": "1.10.2",
"version": "1.10.3",
"description": "Touch-friendly image lightbox for mobile and desktop with jQuery",

@@ -5,0 +5,0 @@ "main": "dist/simple-lightbox.js",

@@ -34,3 +34,3 @@ # simplelightbox

### Options
### JavaScript Options
| Property | Default | Type | Description |

@@ -123,3 +123,35 @@ | -------- | ------- | ---- | ----------- |

### Customization
You can customize Simplelightbox by changing the style in simplelightbox.css.
If you are using SASS, you can customize Simplelightbox with the following variables
```SASS
$sl-font-family: Arial, Baskerville, monospace;
$sl-overlay-background: #fff;
$sl-navigation-color: #000;
$sl-caption-color: #fff;
$sl-caption-background: #000;
$sl-counter-fontsize: 1rem;
$sl-close-fontsize: 3rem;
$sl-breakpoint-medium: 35.5em; // 568px, when 1rem == 16px
$sl-breakpoint-large: 50em; // 800px, when 1rem == 16px
$sl-arrow-fontsize-small: 2rem;
$sl-arrow-fontsize-medium: 3rem;
$sl-arrow-fontsize-large: 3rem;
$sl-img-border-small: 0 none;
$sl-img-border-medium: 0 none;
$sl-img-border-large: 0 none;
$sl-iframe-border-small: 0 none;
$sl-iframe-border-medium: 0 none;
$sl-iframe-border-large: 0 none;
```
### Changelog
**1.10.3 - Merged pull requests #55, #56 and #57. Thanks to karland**
**1.10.2 - Aligned navigation and close buttons #51, fixed image error bug #52**

@@ -165,1 +197,2 @@ **1.10.1 - Added support for jQuery 3.x #50**

[Geoffrey Crofte](http://geoffrey.crofte.fr/) - [Github](https://github.com/creativejuiz/)
[Karl Anders](http://webseiten-anders.de/) - [Github](https://github.com/karland/)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc