Skip to content

Commit b65993a

Browse files
committed
Fix: Overlay causing horizontal scrollbar on resize
1 parent fe592d2 commit b65993a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

js/lightbox.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
var self = this;
121121
var $window = $(window);
122122

123-
$window.on("resize", this.sizeOverlay.call(this));
123+
$window.on('resize', $.proxy(this.sizeOverlay, this));
124124

125125
$('select, object, embed').css({
126126
visibility: "hidden"
@@ -233,10 +233,10 @@
233233
this.currentImageIndex = imageNumber;
234234
};
235235

236-
// Stretch overlay to fit the document
236+
// Stretch overlay to fit the viewport
237237
Lightbox.prototype.sizeOverlay = function() {
238238
this.$overlay
239-
.width($(document).width())
239+
.width($(window).width())
240240
.height($(document).height());
241241
};
242242

0 commit comments

Comments
 (0)