Skip to content

Commit

Permalink
Bugfix no drag&drop in FF, changed default close text, only output da…
Browse files Browse the repository at this point in the history
…ta if lightbox is opened
  • Loading branch information
root committed Oct 25, 2015
1 parent 1436775 commit 12c4bce
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ var gallery = $('.gallery a').simpleLightbox();
gallery.next(); // Next Image
```
### Changelog
**1.4.4 - Bugfix no drag&drop in FF, changed default close text, only output data if lightbox is opened**
**1.4.3 - Bugfix z-index for spinner to low, added sass files**
**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**
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simplelightbox",
"version": "1.4.3",
"version": "1.4.4",
"homepage": "http://andreknieriem.de/simple-lightbox",
"authors": [
"André Rinas <[email protected]> (http://andreknieriem.de)"
Expand Down
25 changes: 14 additions & 11 deletions dist/simple-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $.fn.simpleLightbox = function( options )
captionType: 'attr',
captionsData: 'title',
close: true,
closeText: 'X',
closeText: '×',
showCounter: true,
fileExt: 'png|jpg|jpeg|gif',
animationSpeed: 250,
Expand Down Expand Up @@ -81,29 +81,28 @@ $.fn.simpleLightbox = function( options )
index = 0,
image = $(),
caption = $('<div>').addClass('sl-caption'),
wrapper = $('<div>').addClass('sl-wrapper').addClass(options.className).html('<div class="sl-image"></div>'),
isValidLink = function( element ){
return $( element ).prop( 'tagName' ).toLowerCase() == 'a' && ( new RegExp( '\.(' + options.fileExt + ')$', 'i' ) ).test( $( element ).attr( 'href' ) );
},
setup = function(){
if(options.overlay) overlay.appendTo($('body'));
$('<div>')
.addClass('sl-wrapper').addClass(options.className)
.html('<div class="sl-image"></div>')
.appendTo('body');
image = $('.sl-image');
if(options.close) closeBtn.appendTo($('.sl-wrapper'));
if(options.close) closeBtn.appendTo(wrapper);
if(options.showCounter){
if($(selector).length > 1){
counter.appendTo($('.sl-wrapper'));
$('.sl-wrapper .sl-counter .sl-total').text($(selector).length);
counter.appendTo(wrapper);
counter.find('.sl-total').text($(selector).length);
}

}
if(options.nav) nav.appendTo($('.sl-wrapper'));
if(options.spinner) spinner.appendTo($('.sl-wrapper'));
if(options.nav) nav.appendTo(wrapper);
if(options.spinner) spinner.appendTo(wrapper);

},
openImage = function(elem){
elem.trigger($.Event('show.simplelightbox'));
wrapper.appendTo('body');
if(options.overlay) overlay.appendTo($('body'));
animating = true;
index = $(selector).index(elem);
curImg = $( '<img/>' )
Expand Down Expand Up @@ -227,6 +226,7 @@ $.fn.simpleLightbox = function( options )
triggered = false;
elem.trigger($.Event('close.simplelightbox'));
$('.sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter').fadeOut('fast', function(){
$('.sl-wrapper, .sl-overlay').remove();
if(!triggered) elem.trigger($.Event('closed.simplelightbox'));
triggered = true;
});
Expand Down Expand Up @@ -303,6 +303,7 @@ $.fn.simpleLightbox = function( options )
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)
{
Expand All @@ -312,6 +313,7 @@ $.fn.simpleLightbox = function( options )
swipeDiff = swipeStart - swipeEnd;
if( canTransisions ) slide( 0, -swipeDiff + 'px' );
else image.css( 'left', imageLeft - swipeDiff + 'px' );
return false;
})
.on( 'touchend mouseup touchcancel pointerup pointercancel MSPointerUp MSPointerCancel',function(e)
{
Expand All @@ -326,6 +328,7 @@ $.fn.simpleLightbox = function( options )
else image.animate({ 'left': imageLeft + 'px' }, options.animationSpeed / 2 );
}
}
return false;
});

// Public methods
Expand Down
2 changes: 1 addition & 1 deletion dist/simple-lightbox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "simplelightbox",
"version": "1.4.3",
"version": "1.4.4",
"description": "Touch-friendly image lightbox for mobile and desktop with jQuery",
"main": "dist/simple-lightbox.js",
"repository": {
"type": "git",
"url": "https://github.com/andreknieriem/simplelightbox.git"
},
"dependencies": {
"jquery": ">=1.3.2"
},
"keywords": [
"lightbox",
"modal",
Expand Down

0 comments on commit 12c4bce

Please sign in to comment.