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.8.1 to 1.8.2

2

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

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

@@ -88,5 +88,5 @@

index = 0,
image = $(),
caption = $('<div>').addClass('sl-caption pos-'+options.captionPosition),
wrapper = $('<div>').addClass('sl-wrapper').addClass(options.className).html('<div class="sl-image"></div>'),
image = $('<div>').addClass('sl-image'),
wrapper = $('<div>').addClass('sl-wrapper').addClass(options.className),
isValidLink = function( element ){

@@ -97,3 +97,2 @@ if(!options.fileExt) return true;

setup = function(){
image = $('.sl-image');
if(options.close) closeBtn.appendTo(wrapper);

@@ -114,2 +113,3 @@ if(options.showCounter){

wrapper.appendTo('body');
image.appendTo(wrapper);
if(options.overlay) overlay.appendTo($('body'));

@@ -124,4 +124,5 @@ animating = true;

}
$('.sl-image').html('').attr('style','');
curImg.appendTo($('.sl-image'));
image.html('').attr('style','');
curImg.appendTo(image);
addEvents();
overlay.fadeIn('fast');

@@ -138,3 +139,2 @@ $('.sl-close').fadeIn('fast');

adjustImage = function(dir){
if(!curImg.length) return;

@@ -245,2 +245,65 @@ var tmpImage = new Image(),

},
addEvents = function(){
// resize/responsive
$( window ).on( 'resize.'+prefix, adjustImage );
// close lightbox on close btn
$( document ).on('click.'+prefix, '.sl-close', function(e){
e.preventDefault();
if(opened){ close();}
});
// nav-buttons
nav.on('click.'+prefix, 'button', function(e){
e.preventDefault();
swipeDiff = 0;
loadImage( $(this).hasClass('sl-next') ? 1 : -1 );
});
// touchcontrols
var swipeStart = 0,
swipeEnd = 0,
mousedown = false,
imageLeft = 0;
image
.on( 'touchstart.'+prefix+' mousedown.'+prefix, function(e)
{
if(mousedown) return true;
if( canTransisions ) imageLeft = parseInt( image.css( 'left' ) );
mousedown = true;
swipeStart = e.originalEvent.pageX || e.originalEvent.touches[ 0 ].pageX;
return false;
})
.on( 'touchmove.'+prefix+' mousemove.'+prefix+' pointermove MSPointerMove', function(e)
{
if(!mousedown) return true;
e.preventDefault();
swipeEnd = e.originalEvent.pageX || e.originalEvent.touches[ 0 ].pageX;
swipeDiff = swipeStart - swipeEnd;
if( options.animationSlide ) {
if( canTransisions ) slide( 0, -swipeDiff + 'px' );
else image.css( 'left', imageLeft - swipeDiff + 'px' );
}
})
.on( 'touchend.'+prefix+' mouseup.'+prefix+' touchcancel.'+prefix+' mouseleave.'+prefix+' pointerup pointercancel MSPointerUp MSPointerCancel',function(e)
{
if(mousedown){
mousedown = false;
if( Math.abs( swipeDiff ) > options.swipeTolerance ) {
loadImage( swipeDiff > 0 ? 1 : -1 );
}
else if( options.animationSlide )
{
if( canTransisions ) slide( options.animationSpeed / 1000, 0 + 'px' );
else image.animate({ 'left': imageLeft + 'px' }, options.animationSpeed / 2 );
}
}
});
},
removeEvents = function(){
nav.off('click', 'button');
$( document ).off('click.'+prefix, '.sl-close');
$( window ).off( 'resize.'+prefix);
},
preload = function(){

@@ -301,2 +364,3 @@ var next = (index+1 < 0) ? objects.length -1: (index+1 >= objects.length -1) ? 0 : index+1,

$('.sl-wrapper, .sl-overlay').remove();
removeEvents();
if(!triggered) elem.trigger($.Event('closed.simplelightbox'));

@@ -325,7 +389,7 @@ triggered = true;

if(scrollbarWidth > 0){
$('body').css({'padding-right':padding+scrollbarWidth, 'overflow':'hidden'});
$('body').addClass('hidden-scroll').css({'padding-right':padding+scrollbarWidth});
}
}
} else {
$('body').css({'padding-right':$('body').data('padding'), 'overflow':'visible'});
$('body').removeClass('hidden-scroll').css({'padding-right':$('body').data('padding')});
}

@@ -337,4 +401,3 @@ }

// resize/responsive
$( window ).on( 'resize', adjustImage );

@@ -350,8 +413,2 @@ // open lightbox

// close lightbox on close btn
$( document ).on('click', '.sl-close', function(e){
e.preventDefault();
if(opened){ close();}
});
// close on click on doc

@@ -373,8 +430,2 @@ $( document ).click(function(e){

// nav-buttons
$(document).on('click', '.sl-navigation button', function(e){
e.preventDefault();
swipeDiff = 0;
loadImage( $(this).hasClass('sl-next') ? 1 : -1 );
});

@@ -399,43 +450,2 @@ // keyboard-control

// touchcontrols
var swipeStart = 0,
swipeEnd = 0,
mousedown = false,
imageLeft = 0;
$( document )
.on( 'touchstart mousedown pointerdown MSPointerDown', '.sl-image', function(e)
{
if(mousedown) return true;
if( canTransisions ) imageLeft = parseInt( image.css( 'left' ) );
mousedown = true;
swipeStart = e.originalEvent.pageX || e.originalEvent.touches[ 0 ].pageX;
return false;
})
.on( 'touchmove mousemove pointermove MSPointerMove', function(e)
{
if(!mousedown) return true;
e.preventDefault();
swipeEnd = e.originalEvent.pageX || e.originalEvent.touches[ 0 ].pageX;
swipeDiff = swipeStart - swipeEnd;
if( options.animationSlide ) {
if( canTransisions ) slide( 0, -swipeDiff + 'px' );
else image.css( 'left', imageLeft - swipeDiff + 'px' );
}
})
.on( 'touchend mouseup touchcancel pointerup pointercancel MSPointerUp MSPointerCancel',function(e)
{
if(mousedown){
mousedown = false;
if( Math.abs( swipeDiff ) > options.swipeTolerance ) {
loadImage( swipeDiff > 0 ? 1 : -1 );
}
else if( options.animationSlide )
{
if( canTransisions ) slide( options.animationSpeed / 1000, 0 + 'px' );
else image.animate({ 'left': imageLeft + 'px' }, options.animationSpeed / 2 );
}
}
});
// Public methods

@@ -442,0 +452,0 @@ this.open = function(elem){

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

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

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

@@ -103,2 +103,3 @@ # simplelightbox

### Changelog
**1.8.2 - Better bugfix for #33, finally fixing multiple lightbox on one page slowness issues!**
**1.8.1 - Bugfix for #31, #32 and #33**

@@ -105,0 +106,0 @@ **1.8.0 - New API Events (changed open to show) and little fix in function open() brought by Geoffrey Crofte and some other small bugfixes**

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