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.4.1 to 1.4.2

2

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

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

@@ -70,2 +70,3 @@

opened = false,
selector = this.selector,

@@ -225,2 +226,3 @@ transPrefix = transPrefix(),

close = function(){
if(animating) return;
var elem = $(selector).eq(index),

@@ -307,3 +309,3 @@ triggered = false;

})
.on( 'touchmove mousemove pointermove MSPointerMove', '.sl-image', function(e)
.on( 'touchmove mousemove pointermove MSPointerMove', function(e)
{

@@ -317,13 +319,15 @@ if(!mousedown) return true;

})
.on( 'touchend mouseup touchcancel pointerup pointercancel MSPointerUp MSPointerCancel', '.sl-image' ,function(e)
.on( 'touchend mouseup touchcancel pointerup pointercancel MSPointerUp MSPointerCancel',function(e)
{
mousedown = false;
if( Math.abs( swipeDiff ) > options.swipeTolerance ) {
loadImage( swipeDiff > 0 ? 1 : -1 );
if(mousedown){
mousedown = false;
if( Math.abs( swipeDiff ) > options.swipeTolerance ) {
loadImage( swipeDiff > 0 ? 1 : -1 );
}
else
{
if( canTransisions ) slide( options.animationSpeed / 1000, 0 + 'px' );
else image.animate({ 'left': imageLeft + 'px' }, options.animationSpeed / 2 );
}
}
else
{
if( canTransisions ) slide( options.animationSpeed / 1000, 0 + 'px' );
else image.animate({ 'left': imageLeft + 'px' }, options.animationSpeed / 2 );
}
});

@@ -330,0 +334,0 @@

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

*/
!function(e,t,n){"use strict";e.fn.simpleLightbox=function(a){var a=e.extend({overlay:!0,spinner:!0,nav:!0,navText:["&larr;","&rarr;"],captions:!0,captionSelector:"img",captionType:"attr",captionsData:"title",close:!0,closeText:"X",showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9},a),i=(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=this.selector,s=s(),p=s!==!1?!0:!1,c="simplelb",d=e("<div>").addClass("sl-overlay"),f=e("<button>").addClass("sl-close").html(a.closeText),u=e("<div>").addClass("sl-spinner").html("<div></div>"),g=e("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+a.navText[0]+'</button><button class="sl-next">'+a.navText[1]+"</button>"),h=e("<div>").addClass("sl-counter").html('<span class="sl-current"></span>/<span class="sl-total"></span>'),m=!1,v=0,x=e(),w=e("<div>").addClass("sl-caption"),b=function(t){return"a"==e(t).prop("tagName").toLowerCase()&&new RegExp(".("+a.fileExt+")$","i").test(e(t).attr("href"))},y=function(){a.overlay&&d.appendTo(e("body")),e("<div>").addClass("sl-wrapper").addClass(a.className).html('<div class="sl-image"></div>').appendTo("body"),x=e(".sl-image"),a.close&&f.appendTo(e(".sl-wrapper")),a.showCounter&&e(r).length>1&&(h.appendTo(e(".sl-wrapper")),e(".sl-wrapper .sl-counter .sl-total").text(e(r).length)),a.nav&&g.appendTo(e(".sl-wrapper")),a.spinner&&u.appendTo(e(".sl-wrapper"))},T=function(t){t.trigger(e.Event("show.simplelightbox")),m=!0,v=e(r).index(t),o=e("<img/>").hide().attr("src",t.attr("href")),e(".sl-image").html(""),o.appendTo(e(".sl-image")),d.fadeIn("fast"),e(".sl-close").fadeIn("fast"),u.show(),g.fadeIn("fast"),e(".sl-wrapper .sl-counter .sl-current").text(v+1),h.fadeIn("fast"),C(),a.preloading&&k(),setTimeout(function(){t.trigger(e.Event("shown.simplelightbox"))},a.animationSpeed)},C=function(n){if(o.length){var i=new Image,s=e(t).width()*a.widthRatio,c=e(t).height()*a.heightRatio;i.src=o.attr("src"),i.onload=function(){var d=i.width,f=i.height;if(d>s||f>c){var g=d/f>s/c?d/s:f/c;d/=g,f/=g}e(".sl-image").css({top:(e(t).height()-f)/2+"px",left:(e(t).width()-d)/2+"px"}),u.hide(),o.css({width:d+"px",height:f+"px"}).fadeIn("fast"),l=!0;var h="self"==a.captionSelector?e(r).eq(v):e(r).eq(v).find(a.captionSelector);if("data"==a.captionType)var x=h.data(a.captionsData);else if("text"==a.captionType)var x=h.html();else var x=h.prop(a.captionsData);if(1==n||-1==n){var w={opacity:1};p?(E(0,100*n+"px"),setTimeout(function(){E(a.animationSpeed/1e3,"0px"),50})):w.left=parseInt(e(".sl-image").css("left"))+100*n+"px",e(".sl-image").animate(w,a.animationSpeed,function(){m=!1,S(x)})}else m=!1,S(x)}}},S=function(t){""!=t&&"undefined"!=typeof t&&a.captions&&w.html(t).hide().appendTo(e(".sl-image")).fadeIn("fast")},E=function(t,n){var a={};a[s+"transform"]="translateX("+n+")",a[s+"transition"]=s+"transform "+t+"s linear",e(".sl-image").css(a)},k=function(){var t=0>v+1?e(r).length-1:v+1>=e(r).length-1?0:v+1,n=0>v-1?e(r).length-1:v-1>=e(r).length-1?0:v-1;e("<img />").attr("src",e(r).eq(t).attr("href")).load(),e("<img />").attr("src",e(r).eq(n).attr("href")).load()},I=function(t){u.show();var n=v+t;if(!(m||(0>n||n>=e(r).length)&&0==a.loop)){m=!0,v=0>n?e(r).length-1:n>e(r).length-1?0:n,e(".sl-wrapper .sl-counter .sl-current").text(v+1);var s={opacity:0};p?E(a.animationSpeed/1e3,-100*t-i+"px"):s.left=parseInt(e(".sl-image").css("left"))+-100*t+"px",e(".sl-image").animate(s,a.animationSpeed,function(){setTimeout(function(){var n=e(r).eq(v);o.attr("src",n.attr("href")),e(".sl-caption").remove(),C(t),a.preloading&&k()},100)})}},D=function(){var t=e(r).eq(v),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(){n||t.trigger(e.Event("closed.simplelightbox")),n=!0}),o=e(),l=!1};y(),e(t).on("resize",C),e(n).on("click."+c,this.selector,function(t){if(b(this)){if(t.preventDefault(),m)return!1;T(e(this))}}),e(n).on("click",".sl-close",function(e){e.preventDefault(),l&&D()}),e(n).click(function(t){l&&a.docClose&&0==e(t.target).closest(".sl-image").length&&0==e(t.target).closest(".sl-navigation").length&&D()}),e(n).on("click",".sl-navigation button",function(t){t.preventDefault(),i=0,I(e(this).hasClass("sl-next")?1:-1)}),a.enableKeyboard&&e(n).on("keyup."+c,function(e){if(e.preventDefault(),i=0,l){var t=e.keyCode;27==t&&D(),(37==t||39==e.keyCode)&&I(39==e.keyCode?1:-1)}});var M=0,q=0,X=!1,P=0;return e(n).on("touchstart mousedown pointerdown MSPointerDown",".sl-image",function(e){return X?!0:(p&&(P=parseInt(x.css("left"))),X=!0,void(M=e.originalEvent.pageX||e.originalEvent.touches[0].pageX))}).on("touchmove mousemove pointermove MSPointerMove",".sl-image",function(e){return X?(e.preventDefault(),q=e.originalEvent.pageX||e.originalEvent.touches[0].pageX,i=M-q,void(p?E(0,-i+"px"):x.css("left",P-i+"px"))):!0}).on("touchend mouseup touchcancel pointerup pointercancel MSPointerUp MSPointerCancel",".sl-image",function(){X=!1,Math.abs(i)>a.swipeTolerance?I(i>0?1:-1):p?E(a.animationSpeed/1e3,"0px"):x.animate({left:P+"px"},a.animationSpeed/2)}),this.open=function(e){T(e)},this.next=function(){I(1)},this.prev=function(){I(-1)},this.close=function(){D()},this.destroy=function(){e(n).unbind("click."+c).unbind("keyup."+c),D(),e(".sl-overlay, .sl-wrapper").remove()},this}}(jQuery,window,document);
!function(e,t,n){"use strict";e.fn.simpleLightbox=function(a){var a=e.extend({overlay:!0,spinner:!0,nav:!0,navText:["&larr;","&rarr;"],captions:!0,captionSelector:"img",captionType:"attr",captionsData:"title",close:!0,closeText:"X",showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9},a),i=(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=this.selector,s=s(),p=s!==!1?!0:!1,c="simplelb",d=e("<div>").addClass("sl-overlay"),f=e("<button>").addClass("sl-close").html(a.closeText),u=e("<div>").addClass("sl-spinner").html("<div></div>"),g=e("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+a.navText[0]+'</button><button class="sl-next">'+a.navText[1]+"</button>"),h=e("<div>").addClass("sl-counter").html('<span class="sl-current"></span>/<span class="sl-total"></span>'),m=!1,v=0,x=e(),w=e("<div>").addClass("sl-caption"),b=function(t){return"a"==e(t).prop("tagName").toLowerCase()&&new RegExp(".("+a.fileExt+")$","i").test(e(t).attr("href"))},y=function(){a.overlay&&d.appendTo(e("body")),e("<div>").addClass("sl-wrapper").addClass(a.className).html('<div class="sl-image"></div>').appendTo("body"),x=e(".sl-image"),a.close&&f.appendTo(e(".sl-wrapper")),a.showCounter&&e(r).length>1&&(h.appendTo(e(".sl-wrapper")),e(".sl-wrapper .sl-counter .sl-total").text(e(r).length)),a.nav&&g.appendTo(e(".sl-wrapper")),a.spinner&&u.appendTo(e(".sl-wrapper"))},T=function(t){t.trigger(e.Event("show.simplelightbox")),m=!0,v=e(r).index(t),o=e("<img/>").hide().attr("src",t.attr("href")),e(".sl-image").html(""),o.appendTo(e(".sl-image")),d.fadeIn("fast"),e(".sl-close").fadeIn("fast"),u.show(),g.fadeIn("fast"),e(".sl-wrapper .sl-counter .sl-current").text(v+1),h.fadeIn("fast"),C(),a.preloading&&k(),setTimeout(function(){t.trigger(e.Event("shown.simplelightbox"))},a.animationSpeed)},C=function(n){if(o.length){var i=new Image,s=e(t).width()*a.widthRatio,c=e(t).height()*a.heightRatio;i.src=o.attr("src"),i.onload=function(){var d=i.width,f=i.height;if(d>s||f>c){var g=d/f>s/c?d/s:f/c;d/=g,f/=g}e(".sl-image").css({top:(e(t).height()-f)/2+"px",left:(e(t).width()-d)/2+"px"}),u.hide(),o.css({width:d+"px",height:f+"px"}).fadeIn("fast"),l=!0;var h="self"==a.captionSelector?e(r).eq(v):e(r).eq(v).find(a.captionSelector);if("data"==a.captionType)var x=h.data(a.captionsData);else if("text"==a.captionType)var x=h.html();else var x=h.prop(a.captionsData);if(1==n||-1==n){var w={opacity:1};p?(E(0,100*n+"px"),setTimeout(function(){E(a.animationSpeed/1e3,"0px"),50})):w.left=parseInt(e(".sl-image").css("left"))+100*n+"px",e(".sl-image").animate(w,a.animationSpeed,function(){m=!1,S(x)})}else m=!1,S(x)}}},S=function(t){""!=t&&"undefined"!=typeof t&&a.captions&&w.html(t).hide().appendTo(e(".sl-image")).fadeIn("fast")},E=function(t,n){var a={};a[s+"transform"]="translateX("+n+")",a[s+"transition"]=s+"transform "+t+"s linear",e(".sl-image").css(a)},k=function(){var t=0>v+1?e(r).length-1:v+1>=e(r).length-1?0:v+1,n=0>v-1?e(r).length-1:v-1>=e(r).length-1?0:v-1;e("<img />").attr("src",e(r).eq(t).attr("href")).load(),e("<img />").attr("src",e(r).eq(n).attr("href")).load()},I=function(t){u.show();var n=v+t;if(!(m||(0>n||n>=e(r).length)&&0==a.loop)){m=!0,v=0>n?e(r).length-1:n>e(r).length-1?0:n,e(".sl-wrapper .sl-counter .sl-current").text(v+1);var s={opacity:0};p?E(a.animationSpeed/1e3,-100*t-i+"px"):s.left=parseInt(e(".sl-image").css("left"))+-100*t+"px",e(".sl-image").animate(s,a.animationSpeed,function(){setTimeout(function(){var n=e(r).eq(v);o.attr("src",n.attr("href")),e(".sl-caption").remove(),C(t),a.preloading&&k()},100)})}},D=function(){if(!m){var t=e(r).eq(v),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(){n||t.trigger(e.Event("closed.simplelightbox")),n=!0}),o=e(),l=!1}};y(),e(t).on("resize",C),e(n).on("click."+c,this.selector,function(t){if(b(this)){if(t.preventDefault(),m)return!1;T(e(this))}}),e(n).on("click",".sl-close",function(e){e.preventDefault(),l&&D()}),e(n).click(function(t){l&&a.docClose&&0==e(t.target).closest(".sl-image").length&&0==e(t.target).closest(".sl-navigation").length&&D()}),e(n).on("click",".sl-navigation button",function(t){t.preventDefault(),i=0,I(e(this).hasClass("sl-next")?1:-1)}),a.enableKeyboard&&e(n).on("keyup."+c,function(e){if(e.preventDefault(),i=0,l){var t=e.keyCode;27==t&&D(),(37==t||39==e.keyCode)&&I(39==e.keyCode?1:-1)}});var M=0,q=0,X=!1,P=0;return e(n).on("touchstart mousedown pointerdown MSPointerDown",".sl-image",function(e){return X?!0:(p&&(P=parseInt(x.css("left"))),X=!0,void(M=e.originalEvent.pageX||e.originalEvent.touches[0].pageX))}).on("touchmove mousemove pointermove MSPointerMove",function(e){return X?(e.preventDefault(),q=e.originalEvent.pageX||e.originalEvent.touches[0].pageX,i=M-q,void(p?E(0,-i+"px"):x.css("left",P-i+"px"))):!0}).on("touchend mouseup touchcancel pointerup pointercancel MSPointerUp MSPointerCancel",function(){X&&(X=!1,Math.abs(i)>a.swipeTolerance?I(i>0?1:-1):p?E(a.animationSpeed/1e3,"0px"):x.animate({left:P+"px"},a.animationSpeed/2))}),this.open=function(e){T(e)},this.next=function(){I(1)},this.prev=function(){I(-1)},this.close=function(){D()},this.destroy=function(){e(n).unbind("click."+c).unbind("keyup."+c),D(),e(".sl-overlay, .sl-wrapper").remove()},this}}(jQuery,window,document);
{
"name": "simplelightbox",
"version": "1.4.1",
"version": "1.4.2",
"description": "Touch-friendly image lightbox for mobile and desktop with jQuery",

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

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

### Changelog
**1.4.2 - Bugfix for issue #2 - Drop Event does not fire when mouse leaves window**
**1.4.1 - The whole caption Selector is rewritten. You can now select an element and get its text, use data or attribute**

@@ -77,0 +78,0 @@ **1.4.0 - Caption Attribute can now be what, you want, or data-title. Fixed some small issues**

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