Skip to content

Commit

Permalink
Added triggers for the beforeLoad and load events.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed Apr 11, 2012
1 parent 533c447 commit 41f9481
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ The Image Gallery follows the guideline of the Bootstrap JavaScript collection.

More Options are documented at the start of the Image Gallery source file.

### Events
In addition to the modal events provided by [Bootstrap Modal](http://twitter.github.com/bootstrap/javascript.html#modals), the Image Gallery provides two additional events:

* **beforeLoad**:
Triggered when the next (or previous) image in the gallery is about to be loaded.
* **load**:
Triggered when the next (or previous) image in the gallery has been loaded.

### Fullscreen mode
Fullscreen mode is enabled by adding the CSS class "modal-fullscreen" to the modal element:

Expand Down
5 changes: 4 additions & 1 deletion js/bootstrap-image-gallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Bootstrap Image Gallery 2.4
* Bootstrap Image Gallery 2.5
* https://github.com/blueimp/Bootstrap-Image-Gallery
*
* Copyright 2011, Sebastian Tschan
Expand Down Expand Up @@ -124,6 +124,7 @@
modal = this.$element,
index = this.options.index,
oldImg;
modal.trigger('beforeLoad');
this.abortLoad();
this.stopSlideShow();
// The timeout prevents displaying a loading status,
Expand All @@ -141,8 +142,10 @@
this.loadingImage = loadImage(
this.urls[index],
function (img) {
$this.img = img;
window.clearTimeout($this._loadingTimeout);
modal.removeClass('modal-loading');
modal.trigger('load');
$this.showImage(img);
$this.startSlideShow();
},
Expand Down
2 changes: 1 addition & 1 deletion js/bootstrap-image-gallery.min.js

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

0 comments on commit 41f9481

Please sign in to comment.