Skip to content

Commit

Permalink
disable keyboard control if lightbox is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 4, 2015
1 parent c7d5651 commit 5d03454
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var gallery = $('.gallery a').simpleLightbox();
gallery.next(); // Next Image
```
### Changelog
**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)**
**1.1.2 - Bugfix for looping images**
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.3.0",
"version": "1.3.1",
"homepage": "http://andreknieriem.de/simple-lightbox",
"authors": [
"André Knieriem <[email protected]> (http://andreknieriem.de)"
Expand Down
15 changes: 9 additions & 6 deletions dist/simple-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,15 @@ $.fn.simpleLightbox = function( options )
$( document ).on( 'keyup.'+prefix, function( e ){
e.preventDefault();
swipeDiff = 0;
var key = e.keyCode;
if( key == 27 ) {
close();
}
if( key == 37 || e.keyCode == 39 ) {
loadImage( e.keyCode == 39 ? 1 : -1 );
// keyboard control only if lightbox is open
if(opened){
var key = e.keyCode;
if( key == 27 ) {
close();
}
if( key == 37 || e.keyCode == 39 ) {
loadImage( e.keyCode == 39 ? 1 : -1 );
}
}
});
}
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.

0 comments on commit 5d03454

Please sign in to comment.