Skip to content

Commit

Permalink
Caption Attribute can now be any attribute. Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 13, 2015
1 parent 5d03454 commit d38588c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ Touch-friendly image lightbox for mobile and desktop with jQuery

### Install
```sh
//Bower
bower install simplelightbox

//NPM
npm install simplelightbox
```

### Usage
Expand All @@ -20,7 +24,7 @@ var lightbox = $('.gallery a').simpleLightbox(options);
| nav | true | bool | show arrow-navigation or not |
| navText | ['←','→'] | array | text or html for the navigation arrows |
| captions | true | bool | show captions if availabled or not |
| captionsData | title | string | get the caption from title or data-title attribute |
| captionsData | title | string | get the caption from given attribute or data-title |
| close | true | bool | show the close button or not |
| closeText | 'X' | string | text or html for the close button |
| showCounter | true | bool | show current image index or not |
Expand Down Expand Up @@ -66,6 +70,7 @@ var gallery = $('.gallery a').simpleLightbox();
gallery.next(); // Next Image
```
### Changelog
**1.4.0 - Caption Attribute can now be what, you want, or data-title. Fixed some small issues**
**1.3.1 - Bugfix: disable keyboard control if lightbox is closed**
**1.3.0 - Added current index indicator/counter**
**1.2.0 - Added option for captions attribute (title or data-title)**
Expand Down
5 changes: 3 additions & 2 deletions dist/simple-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $.fn.simpleLightbox = function( options )
nav: true,
navText: ['←','→'],
captions: true,
captionsData: 'title',
close: true,
closeText: 'X',
showCounter: true,
Expand Down Expand Up @@ -149,7 +150,7 @@ $.fn.simpleLightbox = function( options )
.fadeIn('fast');
opened = true;

var captionText = $(selector).eq(index).find('img').prop('title');
var captionText = (options.captionsData == 'data-title') ? $(selector).eq(index).find('img').data('title') : $(selector).eq(index).find('img').prop(options.captionsData);
if(dir == 1 || dir == -1){
var css = { 'opacity': 1.0 };
if( canTransisions ) {
Expand All @@ -172,7 +173,7 @@ $.fn.simpleLightbox = function( options )
},
setCaption = function(captiontext){
if(captiontext != '' && options.captions){
caption.text(captiontext).hide().appendTo($('.sl-image')).fadeIn('fast');
caption.html(captiontext).hide().appendTo($('.sl-image')).fadeIn('fast');
}
},
slide = function(speed, pos){
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.

30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "simplelightbox",
"version": "1.4.0",
"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"
},
"keywords": [
"lightbox",
"modal",
"gallery",
"jquery-plugin",
"touchfriendly",
"responsive",
"popup",
"dialog"
],
"author": {
"name": "Andre Rinas",
"url": "http://www.andreknieriem.de",
"email": "info@andreknieriem.de"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/andreknieriem/simplelightbox/issues"
},
"homepage": "http://andreknieriem.de/simple-lightbox"
}

0 comments on commit d38588c

Please sign in to comment.