Skip to content

Commit

Permalink
Only stretch images smaller than the window size in fullscreen mode i…
Browse files Browse the repository at this point in the history
…f the class "modal-fullscreen-stretch" is present on the modal.
  • Loading branch information
blueimp committed Apr 25, 2012
1 parent fb8e290 commit 15cc5bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ Fullscreen mode is enabled by adding the CSS class "modal-fullscreen" to the mod
$('#modal-gallery').addClass('modal-fullscreen');
```

To automatically stretch images smaller then the window size, also add the class "modal-fullscreen-stretch":

```js
$('#modal-gallery').addClass('modal-fullscreen modal-fullscreen-stretch');
```

Please refer to the demo source code on how to enable real fullscreen mode on supported browsers.

### Deinitialize the click event listener
Expand Down
8 changes: 5 additions & 3 deletions js/bootstrap-image-gallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Bootstrap Image Gallery 2.7
* Bootstrap Image Gallery 2.8
* https://github.com/blueimp/Bootstrap-Image-Gallery
*
* Copyright 2011, Sebastian Tschan
Expand Down Expand Up @@ -311,12 +311,14 @@
windowHeight = $(window).height();
if (modal.hasClass('modal-fullscreen')) {
this._loadImageOptions = {
minWidth: windowWidth,
minHeight: windowHeight,
maxWidth: windowWidth,
maxHeight: windowHeight,
canvas: options.canvas
};
if (modal.hasClass('modal-fullscreen-stretch')) {
this._loadImageOptions.minWidth = windowWidth;
this._loadImageOptions.minHeight = windowHeight;
}
} else {
this._loadImageOptions = {
maxWidth: windowWidth - options.offsetWidth,
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 15cc5bd

Please sign in to comment.