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

Commit 913b6ea

Browse files
committed
Fix #1661 and #1658
- Enable custom click events on fancyboxed elements - Enable thumbs.autoStart using `data-options`
1 parent 65c7433 commit 913b6ea

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

dist/jquery.fancybox.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==================================================
2-
// fancyBox v3.1.27
2+
// fancyBox v3.1.28
33
//
44
// Licensed GPLv3 for open source use
55
// or fancyBox Commercial License for commercial use
@@ -2645,7 +2645,7 @@
26452645

26462646
$.fancybox = {
26472647

2648-
version : "3.1.27",
2648+
version : "3.1.28",
26492649
defaults : defaults,
26502650

26512651

@@ -2923,12 +2923,11 @@
29232923
var target = e.currentTarget,
29242924
opts = e.data ? e.data.options : {},
29252925
items = opts.selector ? $( opts.selector ) : ( e.data ? e.data.items : [] ),
2926-
value = $(target).attr( 'data-fancybox' ) || '',
2926+
value = $( target ).attr( 'data-fancybox' ) || '',
29272927
index = 0,
29282928
active = $.fancybox.getInstance();
29292929

29302930
e.preventDefault();
2931-
e.stopPropagation();
29322931

29332932
// Avoid opening multiple times
29342933
if ( active && active.current.opts.$orig.is( target ) ) {
@@ -4578,7 +4577,7 @@
45784577

45794578
this.$list.find('img').hide().one('load', function() {
45804579

4581-
var $parent = $(this).parent().removeClass('fancybox-thumbs-loading'),
4580+
var $parent = $(this).parent().removeClass( 'fancybox-thumbs-loading' ),
45824581
thumbWidth = $parent.outerWidth(),
45834582
thumbHeight = $parent.outerHeight(),
45844583
width,
@@ -4589,12 +4588,12 @@
45894588
width = this.naturalWidth || this.width;
45904589
height = this.naturalHeight || this.height;
45914590

4592-
//Calculate thumbnail width/height and center it
4591+
// Calculate thumbnail width/height and center it
45934592

45944593
widthRatio = width / thumbWidth;
45954594
heightRatio = height / thumbHeight;
45964595

4597-
if (widthRatio >= 1 && heightRatio >= 1) {
4596+
if ( widthRatio >= 1 && heightRatio >= 1 ) {
45984597
if (widthRatio > heightRatio) {
45994598
width = width / heightRatio;
46004599
height = thumbHeight;
@@ -4624,9 +4623,9 @@
46244623
if ( this.instance.current ) {
46254624
this.$list
46264625
.children()
4627-
.removeClass('fancybox-thumbs-active')
4628-
.filter('[data-index="' + this.instance.current.index + '"]')
4629-
.addClass('fancybox-thumbs-active')
4626+
.removeClass( 'fancybox-thumbs-active' )
4627+
.filter( '[data-index="' + this.instance.current.index + '"]' )
4628+
.addClass( 'fancybox-thumbs-active' )
46304629
.focus();
46314630
}
46324631

@@ -4699,7 +4698,7 @@
46994698
return;
47004699
}
47014700

4702-
if ( firstRun && instance.opts.thumbs.autoStart === true ) {
4701+
if ( firstRun && item.opts.thumbs.autoStart === true ) {
47034702
Thumbs.show();
47044703
}
47054704

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.

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.1.27",
4+
"version": "3.1.28",
55
"homepage": "http://fancyapps.com/fancybox/",
66
"main": "./dist/jquery.fancybox.js",
77
"author": "fancyApps",

src/js/core.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,12 +2913,11 @@
29132913
var target = e.currentTarget,
29142914
opts = e.data ? e.data.options : {},
29152915
items = opts.selector ? $( opts.selector ) : ( e.data ? e.data.items : [] ),
2916-
value = $(target).attr( 'data-fancybox' ) || '',
2916+
value = $( target ).attr( 'data-fancybox' ) || '',
29172917
index = 0,
29182918
active = $.fancybox.getInstance();
29192919

29202920
e.preventDefault();
2921-
e.stopPropagation();
29222921

29232922
// Avoid opening multiple times
29242923
if ( active && active.current.opts.$orig.is( target ) ) {

src/js/thumbs.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878
this.$list.find('img').hide().one('load', function() {
7979

80-
var $parent = $(this).parent().removeClass('fancybox-thumbs-loading'),
80+
var $parent = $(this).parent().removeClass( 'fancybox-thumbs-loading' ),
8181
thumbWidth = $parent.outerWidth(),
8282
thumbHeight = $parent.outerHeight(),
8383
width,
@@ -88,12 +88,12 @@
8888
width = this.naturalWidth || this.width;
8989
height = this.naturalHeight || this.height;
9090

91-
//Calculate thumbnail width/height and center it
91+
// Calculate thumbnail width/height and center it
9292

9393
widthRatio = width / thumbWidth;
9494
heightRatio = height / thumbHeight;
9595

96-
if (widthRatio >= 1 && heightRatio >= 1) {
96+
if ( widthRatio >= 1 && heightRatio >= 1 ) {
9797
if (widthRatio > heightRatio) {
9898
width = width / heightRatio;
9999
height = thumbHeight;
@@ -123,9 +123,9 @@
123123
if ( this.instance.current ) {
124124
this.$list
125125
.children()
126-
.removeClass('fancybox-thumbs-active')
127-
.filter('[data-index="' + this.instance.current.index + '"]')
128-
.addClass('fancybox-thumbs-active')
126+
.removeClass( 'fancybox-thumbs-active' )
127+
.filter( '[data-index="' + this.instance.current.index + '"]' )
128+
.addClass( 'fancybox-thumbs-active' )
129129
.focus();
130130
}
131131

@@ -198,7 +198,7 @@
198198
return;
199199
}
200200

201-
if ( firstRun && instance.opts.thumbs.autoStart === true ) {
201+
if ( firstRun && item.opts.thumbs.autoStart === true ) {
202202
Thumbs.show();
203203
}
204204

0 commit comments

Comments
 (0)