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

Commit 8d2d48d

Browse files
committed
Collection of tweaks
- package.json main file points to uncompressed version; - new "onFullscreenChange" event; - it is now possible to make elements clickable by setting `data-selectable="true"`; - fixed issue when ajax response contains additional elements; - improved "hash" module;
1 parent 60c3724 commit 8d2d48d

11 files changed

+85
-58
lines changed

dist/jquery.fancybox.css

+12-4
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
.fancybox-slide--next {
160160
z-index: 99995; }
161161

162-
.fancybox-slide > * {
162+
.fancybox-slide > div {
163163
display: inline-block;
164164
position: relative;
165165
padding: 24px;
@@ -188,7 +188,11 @@
188188
background-size: 100% 100%;
189189
background-repeat: no-repeat;
190190
-webkit-backface-visibility: hidden;
191-
backface-visibility: hidden; }
191+
backface-visibility: hidden;
192+
-webkit-user-select: none;
193+
-moz-user-select: none;
194+
-ms-user-select: none;
195+
user-select: none; }
192196

193197
.fancybox-can-zoomOut .fancybox-image-wrap {
194198
cursor: -webkit-zoom-out;
@@ -217,7 +221,11 @@
217221
padding: 0;
218222
border: 0;
219223
max-width: none;
220-
max-height: none; }
224+
max-height: none;
225+
-webkit-user-select: none;
226+
-moz-user-select: none;
227+
-ms-user-select: none;
228+
user-select: none; }
221229

222230
.fancybox-spaceball {
223231
z-index: 1; }
@@ -475,7 +483,7 @@
475483
opacity: 0.3; }
476484

477485
/* Loading indicator */
478-
.fancybox-loading {
486+
.fancybox-slide > .fancybox-loading {
479487
border: 6px solid rgba(100, 100, 100, 0.4);
480488
border-top: 6px solid rgba(255, 255, 255, 0.6);
481489
border-radius: 100%;

dist/jquery.fancybox.js

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==================================================
2-
// fancyBox v3.1.24
2+
// fancyBox v3.1.25
33
//
44
// Licensed GPLv3 for open source use
55
// or fancyBox Commercial License for commercial use
@@ -1964,7 +1964,7 @@
19641964
slide.$content = $( content ).appendTo( slide.$slide );
19651965

19661966
if ( slide.opts.smallBtn && !slide.$smallBtn ) {
1967-
slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content );
1967+
slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content.filter('div').first() );
19681968
}
19691969

19701970
this.afterLoad( slide );
@@ -2629,7 +2629,7 @@
26292629

26302630
$.fancybox = {
26312631

2632-
version : "3.1.24",
2632+
version : "3.1.25",
26332633
defaults : defaults,
26342634

26352635

@@ -2971,7 +2971,7 @@
29712971

29722972
$D.on( 'click.fb-start', '[data-fancybox]', _run );
29732973

2974-
}( window, document, window.jQuery ));
2974+
}( window, document, window.jQuery || jQuery ));
29752975

29762976
// ==========================================================================
29772977
//
@@ -3264,7 +3264,8 @@
32643264
};
32653265

32663266
var isClickable = function( $el ) {
3267-
if ( $el.is('a,button,input,select,textarea') || $.isFunction( $el.get(0).onclick ) ) {
3267+
3268+
if ( $el.is('a,button,input,select,textarea') || $.isFunction( $el.get(0).onclick ) || $el.data('selectable') ) {
32683269
return true;
32693270
}
32703271

@@ -3381,8 +3382,6 @@
33813382
$(document).on( isTouchDevice ? 'touchend.fb.touch touchcancel.fb.touch' : 'mouseup.fb.touch mouseleave.fb.touch', $.proxy(self, "ontouchend"));
33823383
$(document).on( isTouchDevice ? 'touchmove.fb.touch' : 'mousemove.fb.touch', $.proxy(self, "ontouchmove"));
33833384

3384-
e.stopPropagation();
3385-
33863385
if ( !(instance.current.opts.touch || instance.canPan() ) || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) {
33873386

33883387
// Prevent ghosting
@@ -3393,6 +3392,8 @@
33933392
return;
33943393
}
33953394

3395+
e.stopPropagation();
3396+
33963397
if ( !( $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) ) {
33973398
e.preventDefault();
33983399
}
@@ -4369,12 +4370,16 @@
43694370

43704371
// If browser does not have Full Screen API, then simply unset default button template and stop
43714372
if ( !fn ) {
4372-
$.fancybox.defaults.btnTpl.fullScreen = false;
4373+
4374+
if ( $ && $.fancybox ) {
4375+
$.fancybox.defaults.btnTpl.fullScreen = false;
4376+
}
43734377

43744378
return;
43754379
}
43764380

43774381
var FullScreen = {
4382+
43784383
request : function ( elem ) {
43794384

43804385
elem = elem || document.documentElement;
@@ -4472,6 +4477,8 @@
44724477
instance.update( true, true, 0 );
44734478
}
44744479

4480+
instance.trigger('onFullscreenChange', FullScreen.isFullscreen() );
4481+
44754482
});
44764483

44774484
}(document, window.jQuery));
@@ -4793,7 +4800,7 @@
47934800
}
47944801

47954802
// Get gallery name from current instance
4796-
function getGallery( instance ) {
4803+
function getGalleryID( instance ) {
47974804
var opts;
47984805

47994806
if ( !instance ) {
@@ -4802,7 +4809,7 @@
48024809

48034810
opts = instance.current ? instance.current.opts : instance.opts;
48044811

4805-
return opts.$orig ? opts.$orig.data( 'fancybox' ) : ( opts.hash || '' );
4812+
return opts.hash || ( opts.$orig ? opts.$orig.data( 'fancybox' ) : '' );
48064813
}
48074814

48084815
// Star when DOM becomes ready
@@ -4826,7 +4833,7 @@
48264833
}
48274834

48284835
url = parseUrl();
4829-
gallery = getGallery( instance );
4836+
gallery = getGalleryID( instance );
48304837

48314838
// Make sure gallery start index matches index from hash
48324839
if ( gallery && url.gallery && gallery == url.gallery ) {
@@ -4838,11 +4845,11 @@
48384845
'beforeShow.fb' : function( e, instance, current ) {
48394846
var gallery;
48404847

4841-
if ( current.opts.hash === false ) {
4848+
if ( !current || current.opts.hash === false ) {
48424849
return;
48434850
}
48444851

4845-
gallery = getGallery( instance );
4852+
gallery = getGalleryID( instance );
48464853

48474854
// Update window hash
48484855
if ( gallery && gallery !== '' ) {
@@ -4886,7 +4893,7 @@
48864893
return;
48874894
}
48884895

4889-
gallery = getGallery( instance );
4896+
gallery = getGalleryID( instance );
48904897
origHash = instance && instance.opts.origHash ? instance.opts.origHash : '';
48914898

48924899
// Remove hash from location bar
@@ -4916,8 +4923,6 @@
49164923
currentHash = null;
49174924

49184925
$.fancybox.close();
4919-
4920-
shouldCreateHistory = true;
49214926
}
49224927

49234928
} else if ( url.gallery !== '' ) {
@@ -4932,5 +4937,4 @@
49324937

49334938
});
49344939

4935-
49364940
}(document, window, window.jQuery));

dist/jquery.fancybox.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.fancybox.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@ <h3>
333333
jQuery 3+ is preferred, but fancyBox works with jQuery 1.9.1+ and jQuery 2+
334334
</p>
335335

336+
<h4 class="important">Important</h4>
337+
338+
<p>
339+
If you experience issues with image zooming, then update jQuery to the latest (at least v3.2.1).
340+
</p>
341+
336342
<h3>Compatibility</h3>
337343

338344
<p>
@@ -739,7 +745,7 @@ <h2 id="embedding">Embedding</h2>
739745
Vimeo video
740746
&lt;/a&gt;
741747

742-
&lt;a data-fancybox href=&quot;https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572&quot;&gt;
748+
&lt;a data-fancybox href=&quot;https://www.google.com/maps/search/Empire+State+Building/&quot;&gt;
743749
Google Map
744750
&lt;/a&gt;
745751

@@ -1214,7 +1220,7 @@ <h3 id="core_methods">Core methods</h3>
12141220

12151221

12161222
<pre><code>// Close only the currently active or all fancyBox instances
1217-
$.fancybox.close( all );
1223+
$.fancybox.close( true );
12181224

12191225
// Open the fancyBox right away
12201226
$.fancybox.open( items, opts, index );

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@fancyapps/fancybox",
33
"description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
4-
"version": "3.1.24",
4+
"version": "3.1.25",
55
"homepage": "http://fancyapps.com/fancybox/",
6-
"main": "./dist/jquery.fancybox.min.js",
6+
"main": "./dist/jquery.fancybox.js",
77
"author": "fancyApps",
88
"license": "GPL-3.0",
99
"repository": {

src/css/core.css

+4-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
z-index: 99995;
173173
}
174174

175-
.fancybox-slide > * {
175+
.fancybox-slide > div {
176176
display: inline-block;
177177
position: relative;
178178
padding: 24px;
@@ -200,6 +200,7 @@
200200
background-size: 100% 100%;
201201
background-repeat: no-repeat;
202202
backface-visibility: hidden;
203+
user-select: none;
203204
}
204205

205206
.fancybox-can-zoomOut .fancybox-image-wrap {
@@ -230,6 +231,7 @@
230231
border: 0;
231232
max-width: none;
232233
max-height: none;
234+
user-select: none;
233235
}
234236

235237
.fancybox-spaceball {
@@ -520,7 +522,7 @@
520522

521523
/* Loading indicator */
522524

523-
.fancybox-loading {
525+
.fancybox-slide > .fancybox-loading {
524526
border: 6px solid rgba(100, 100, 100, .4);
525527
border-top: 6px solid rgba(255, 255, 255, .6);
526528
border-radius: 100%;

src/js/core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,7 @@
19541954
slide.$content = $( content ).appendTo( slide.$slide );
19551955

19561956
if ( slide.opts.smallBtn && !slide.$smallBtn ) {
1957-
slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content );
1957+
slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content.filter('div').first() );
19581958
}
19591959

19601960
this.afterLoad( slide );
@@ -2961,4 +2961,4 @@
29612961

29622962
$D.on( 'click.fb-start', '[data-fancybox]', _run );
29632963

2964-
}( window, document, window.jQuery ));
2964+
}( window, document, window.jQuery || jQuery ));

src/js/fullscreen.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,16 @@
7878

7979
// If browser does not have Full Screen API, then simply unset default button template and stop
8080
if ( !fn ) {
81-
$.fancybox.defaults.btnTpl.fullScreen = false;
81+
82+
if ( $ && $.fancybox ) {
83+
$.fancybox.defaults.btnTpl.fullScreen = false;
84+
}
8285

8386
return;
8487
}
8588

8689
var FullScreen = {
90+
8791
request : function ( elem ) {
8892

8993
elem = elem || document.documentElement;
@@ -181,6 +185,8 @@
181185
instance.update( true, true, 0 );
182186
}
183187

188+
instance.trigger('onFullscreenChange', FullScreen.isFullscreen() );
189+
184190
});
185191

186192
}(document, window.jQuery));

src/js/guestures.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
};
6666

6767
var isClickable = function( $el ) {
68-
if ( $el.is('a,button,input,select,textarea') || $.isFunction( $el.get(0).onclick ) ) {
68+
69+
if ( $el.is('a,button,input,select,textarea') || $.isFunction( $el.get(0).onclick ) || $el.data('selectable') ) {
6970
return true;
7071
}
7172

@@ -182,8 +183,6 @@
182183
$(document).on( isTouchDevice ? 'touchend.fb.touch touchcancel.fb.touch' : 'mouseup.fb.touch mouseleave.fb.touch', $.proxy(self, "ontouchend"));
183184
$(document).on( isTouchDevice ? 'touchmove.fb.touch' : 'mousemove.fb.touch', $.proxy(self, "ontouchmove"));
184185

185-
e.stopPropagation();
186-
187186
if ( !(instance.current.opts.touch || instance.canPan() ) || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) {
188187

189188
// Prevent ghosting
@@ -194,6 +193,8 @@
194193
return;
195194
}
196195

196+
e.stopPropagation();
197+
197198
if ( !( $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) ) {
198199
e.preventDefault();
199200
}

0 commit comments

Comments
 (0)