Skip to content

Commit

Permalink
Bugfix for #41 and added option for additional html inside images #40
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 3, 2016
1 parent 6d3e7ed commit 61a6b8b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var lightbox = $('.gallery a').simpleLightbox(options);
| disableScroll | true | bool | stop scrolling page if lightbox is opened |
| alertError | true | bool | show an alert, if image was not found. If false error will be ignored |
| alertErrorMessage | 'Image not found, next image will be loaded' | string | the message displayed if image was not found |
| additionalHtml | false | string | Additional HTML showing inside every image. Usefull for watermark etc. If false nothing is added |

### Events
| Name | Description |
Expand Down Expand Up @@ -100,6 +101,7 @@ var lightbox2 = $('.lighbox-2 a').simpleLightbox();
```

### Changelog
**1.8.4 - Bugfix for #41 and added option for additional html inside images #40**
**1.8.3 - Bugfix for #38 and small other fix for loop false option**
**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**
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.8.3",
"version": "1.8.4",
"homepage": "http://andreknieriem.de/simple-lightbox",
"authors": [
"André Rinas <[email protected]> (http://andreknieriem.de)"
Expand Down
11 changes: 7 additions & 4 deletions dist/simple-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ $.fn.simpleLightbox = function( options )
disableRightClick: false,
disableScroll: true,
alertError: true,
alertErrorMessage: 'Image not found, next image will be loaded'
alertErrorMessage: 'Image not found, next image will be loaded',
additionalHtml: false
}, options );

// global variables
Expand Down Expand Up @@ -224,7 +225,9 @@ $.fn.simpleLightbox = function( options )
animating = false;
setCaption(captionText);
}

if(options.additionalHtml && $('.sl-additional-html').length == 0){
$('<div>').html(options.additionalHtml).addClass('sl-additional-html').appendTo($('.sl-image'));
}
}
},
setCaption = function(captiontext){
Expand All @@ -243,7 +246,7 @@ $.fn.simpleLightbox = function( options )
$( window ).on( 'resize.'+prefix, adjustImage );

// close lightbox on close btn
$( document ).on('click.'+prefix, '.sl-close', function(e){
$( document ).on('click.'+prefix+ ' touchstart.'+prefix, '.sl-close', function(e){
e.preventDefault();
if(opened){ close();}
});
Expand Down Expand Up @@ -408,7 +411,7 @@ $.fn.simpleLightbox = function( options )
});

// close on click on doc
$( document ).click(function(e){
$( document ).on('click.'+prefix+ ' touchstart.'+prefix, function(e){
if(opened){
if((options.docClose && $(e.target).closest('.sl-image').length == 0 && $(e.target).closest('.sl-navigation').length == 0)){
close();
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simplelightbox",
"version": "1.8.3",
"version": "1.8.4",
"description": "Touch-friendly image lightbox for mobile and desktop with jQuery",
"main": "dist/simple-lightbox.js",
"repository": {
Expand Down

0 comments on commit 61a6b8b

Please sign in to comment.