Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 059c440

Browse files
committed
Fixed #1910 body jumps 1px
+ new option `hideScrollbar`
1 parent 75abe74 commit 059c440

File tree

5 files changed

+29
-27
lines changed

5 files changed

+29
-27
lines changed

dist/jquery.fancybox.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==================================================
2-
// fancyBox v3.3.4
2+
// fancyBox v3.3.5
33
//
44
// Licensed GPLv3 for open source use
55
// or fancyBox Commercial License for commercial use
@@ -530,12 +530,12 @@
530530
// Hide scrollbars
531531
// ===============
532532

533-
if (!$.fancybox.getInstance()) {
533+
if (!$.fancybox.getInstance() && firstItemOpts.hideScrollbar !== false) {
534534
$("body").addClass("fancybox-active");
535535

536536
if (!$.fancybox.isMobile && document.body.scrollHeight > window.innerHeight) {
537537
if (scrollbarWidth === undefined) {
538-
$scrollDiv = $('<div style="width:50px;height:50px;overflow:scroll;" />').appendTo("body");
538+
$scrollDiv = $('<div style="width:100px;height:100px;overflow:scroll;" />').appendTo("body");
539539

540540
scrollbarWidth = $.fancybox.scrollbarWidth = $scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth;
541541

@@ -2745,7 +2745,7 @@
27452745
});
27462746

27472747
$.fancybox = {
2748-
version: "3.3.4",
2748+
version: "3.3.5",
27492749
defaults: defaults,
27502750

27512751
// Get current instance and execute a command.

dist/jquery.fancybox.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,10 @@ <h2>Options</h2>
831831
// and they will be placed into toolbar (class=&quot;fancybox-toolbar&quot;` element)
832832
buttons: [
833833
&quot;zoom&quot;,
834-
//'share',
835-
//'slideShow',
836-
//'fullScreen',
837-
//'download',
834+
//&quot;share&quot;,
835+
//&quot;slideShow&quot;,
836+
//&quot;fullScreen&quot;,
837+
//&quot;download&quot;,
838838
&quot;thumbs&quot;,
839839
&quot;close&quot;
840840
],
@@ -951,7 +951,7 @@ <h2>Options</h2>
951951

952952
btnTpl: {
953953
download:
954-
'&lt;a download data-fancybox-download class=&quot;fancybox-button fancybox-button--download&quot; title=&quot;{{DOWNLOAD}}&quot;&gt;' +
954+
'&lt;a download data-fancybox-download class=&quot;fancybox-button fancybox-button--download&quot; title=&quot;{{DOWNLOAD}}&quot; href=&quot;javascript:;&quot;&gt;' +
955955
'&lt;svg viewBox=&quot;0 0 40 40&quot;&gt;' +
956956
'&lt;path d=&quot;M13,16 L20,23 L27,16 M20,7 L20,23 M10,24 L10,28 L30,28 L30,24&quot; /&gt;' +
957957
&quot;&lt;/svg&gt;&quot; +
@@ -978,23 +978,26 @@ <h2>Options</h2>
978978

979979
// Arrows
980980
arrowLeft:
981-
'&lt;button data-fancybox-prev class=&quot;fancybox-button fancybox-button--arrow_left&quot; title=&quot;{{PREV}}&quot;&gt;' +
981+
'&lt;a data-fancybox-prev class=&quot;fancybox-button fancybox-button--arrow_left&quot; title=&quot;{{PREV}}&quot; href=&quot;javascript:;&quot;&gt;' +
982982
'&lt;svg viewBox=&quot;0 0 40 40&quot;&gt;' +
983983
'&lt;path d=&quot;M18,12 L10,20 L18,28 M10,20 L30,20&quot;&gt;&lt;/path&gt;' +
984984
&quot;&lt;/svg&gt;&quot; +
985-
&quot;&lt;/button&gt;&quot;,
985+
&quot;&lt;/a&gt;&quot;,
986986

987987
arrowRight:
988-
'&lt;button data-fancybox-next class=&quot;fancybox-button fancybox-button--arrow_right&quot; title=&quot;{{NEXT}}&quot;&gt;' +
988+
'&lt;a data-fancybox-next class=&quot;fancybox-button fancybox-button--arrow_right&quot; title=&quot;{{NEXT}}&quot; href=&quot;javascript:;&quot;&gt;' +
989989
'&lt;svg viewBox=&quot;0 0 40 40&quot;&gt;' +
990990
'&lt;path d=&quot;M10,20 L30,20 M22,12 L30,20 L22,28&quot;&gt;&lt;/path&gt;' +
991991
&quot;&lt;/svg&gt;&quot; +
992-
&quot;&lt;/button&gt;&quot;
992+
&quot;&lt;/a&gt;&quot;
993993
},
994994

995995
// Container is injected into this element
996996
parentEl: &quot;body&quot;,
997997

998+
// Hide browser vertical scrollbars; use at your own risk
999+
hideScrollbar: true,
1000+
9981001
// Focus handling
9991002
// ==============
10001003

@@ -1027,13 +1030,13 @@ <h2>Options</h2>
10271030
// Customize or add new media types
10281031
// Example:
10291032
/*
1030-
media : {
1031-
youtube : {
1032-
params : {
1033-
autoplay : 0
1033+
media : {
1034+
youtube : {
1035+
params : {
1036+
autoplay : 0
1037+
}
10341038
}
10351039
}
1036-
}
10371040
*/
10381041
media: {},
10391042

@@ -1060,8 +1063,8 @@ <h2>Options</h2>
10601063
// Example:
10611064
/*
10621065
afterShow: function( instance, current ) {
1063-
console.info( 'Clicked element:' );
1064-
console.info( current.opts.$orig );
1066+
console.info( 'Clicked element:' );
1067+
console.info( current.opts.$orig );
10651068
}
10661069
*/
10671070

@@ -1115,7 +1118,6 @@ <h2>Options</h2>
11151118

11161119
mobile: {
11171120
idleTime: false,
1118-
11191121
clickContent: function(current, event) {
11201122
return current.type === &quot;image&quot; ? &quot;toggleControls&quot; : false;
11211123
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@fancyapps/fancybox",
33
"description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
4-
"version": "3.3.4",
4+
"version": "3.3.5",
55
"homepage": "http://fancyapps.com/fancybox/",
66
"main": "./dist/jquery.fancybox.js",
77
"author": "fancyApps",

src/js/core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,12 @@
520520
// Hide scrollbars
521521
// ===============
522522

523-
if (!$.fancybox.getInstance()) {
523+
if (!$.fancybox.getInstance() && firstItemOpts.hideScrollbar !== false) {
524524
$("body").addClass("fancybox-active");
525525

526526
if (!$.fancybox.isMobile && document.body.scrollHeight > window.innerHeight) {
527527
if (scrollbarWidth === undefined) {
528-
$scrollDiv = $('<div style="width:50px;height:50px;overflow:scroll;" />').appendTo("body");
528+
$scrollDiv = $('<div style="width:100px;height:100px;overflow:scroll;" />').appendTo("body");
529529

530530
scrollbarWidth = $.fancybox.scrollbarWidth = $scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth;
531531

0 commit comments

Comments
 (0)