Skip to content

Commit

Permalink
Add disableScrolling option
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh committed Dec 14, 2015
1 parent 65ea459 commit 00f87bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ by [Lokesh Dhakar](http://www.lokeshdhakar.com)
- **Maintenance.** Get open Issues and PRs number down.
- **Mobile experience.** Redo animations and interactions from scratch and include gesture support.

### v3.0 - IN PLANNING PHASE
### v3.0 - In Brainstorming Phase

- Add touch gesture support.
- Optimize layout for mobile.
Expand All @@ -34,6 +34,10 @@ by [Lokesh Dhakar](http://www.lokeshdhakar.com)

## Changelog

### v2.8.2 - 2015-07-09

- [Add] - Add option to disable vertical scrolling [#487](https://github.com/lokesh/lightbox2/pull/487)

### v2.8.1 - 2015-07-09

- [Fix] Change AMD jQuery require statement to use all lowercase. [#464](https://github.com/lokesh/lightbox2/pull/464) Thanks [@vtforester](https://github.com/vtforester)
Expand Down
4 changes: 2 additions & 2 deletions src/css/lightbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ body:after {
display: none;
}

body.overlay-locked {
overflow-y: hidden;
body.lb-disable-scrolling {
overflow: hidden;
}

.lightboxOverlay {
Expand Down
12 changes: 6 additions & 6 deletions src/js/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
resizeDuration: 700,
showImageNumberLabel: true,
wrapAround: false,
overlayLocked: false
disableScrolling: false
};

Lightbox.prototype.option = function(options) {
Expand Down Expand Up @@ -196,9 +196,9 @@
left: left + 'px'
}).fadeIn(this.options.fadeDuration);

// set overlay locked
if (this.options.overlayLocked) {
$('body').addClass('overlay-locked');
// Disable scrolling of the page while open
if (this.options.disableScrolling) {
$('body').addClass('lb-disable-scrolling');
}

this.changeImage(imageNumber);
Expand Down Expand Up @@ -444,8 +444,8 @@
$('select, object, embed').css({
visibility: 'visible'
});
if (this.options.overlayLocked) {
$('body').removeClass('overlay-locked');
if (this.options.disableScrolling) {
$('body').removeClass('lb-disable-scrolling');
}
};

Expand Down

0 comments on commit 00f87bc

Please sign in to comment.