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

Commit 4658124

Browse files
committed
Updated to v3.5.5
- Fixed #2150 - Caption is not cleared
1 parent f5e272a commit 4658124

File tree

4 files changed

+32
-24
lines changed

4 files changed

+32
-24
lines changed

dist/jquery.fancybox.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==================================================
2-
// fancyBox v3.5.4
2+
// fancyBox v3.5.5
33
//
44
// Licensed GPLv3 for open source use
55
// or fancyBox Commercial License for commercial use
@@ -2303,24 +2303,26 @@
23032303
var self = this,
23042304
current = slide || self.current,
23052305
caption = current.opts.caption,
2306+
preventOverlap = current.opts.preventCaptionOverlap,
23062307
$caption = self.$refs.caption,
2307-
captionH = false,
2308-
preventOverlap = current.opts.preventCaptionOverlap;
2308+
$clone,
2309+
captionH = false;
23092310

23102311
$caption.toggleClass("fancybox-caption--separate", preventOverlap);
23112312

23122313
if (preventOverlap && caption && caption.length) {
23132314
if (current.pos !== self.currPos) {
2314-
$caption = $caption
2315-
.clone()
2316-
.empty()
2317-
.appendTo($caption.parent());
2315+
$clone = $caption.clone().appendTo($caption.parent());
23182316

2319-
$caption.html(caption);
2317+
$clone
2318+
.children()
2319+
.eq(0)
2320+
.empty()
2321+
.html(caption);
23202322

2321-
captionH = $caption.outerHeight(true);
2323+
captionH = $clone.outerHeight(true);
23222324

2323-
$caption.empty().remove();
2325+
$clone.empty().remove();
23242326
} else if (self.$caption) {
23252327
captionH = self.$caption.outerHeight(true);
23262328
}
@@ -2963,6 +2965,8 @@
29632965
.children()
29642966
.eq(0)
29652967
.html(caption);
2968+
} else {
2969+
self.$caption = null;
29662970
}
29672971

29682972
if (!self.hasHiddenControls && !self.isIdle) {
@@ -3046,7 +3050,7 @@
30463050
});
30473051

30483052
$.fancybox = {
3049-
version: "3.5.4",
3053+
version: "3.5.5",
30503054
defaults: defaults,
30513055

30523056
// Get current instance and execute a command.

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.

package.json

+1-1
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.5.4",
4+
"version": "3.5.5",
55
"homepage": "https://fancyapps.com/fancybox/3/",
66
"main": "dist/jquery.fancybox.js",
77
"style": "dist/jquery.fancybox.css",

src/js/core.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -2293,24 +2293,26 @@
22932293
var self = this,
22942294
current = slide || self.current,
22952295
caption = current.opts.caption,
2296+
preventOverlap = current.opts.preventCaptionOverlap,
22962297
$caption = self.$refs.caption,
2297-
captionH = false,
2298-
preventOverlap = current.opts.preventCaptionOverlap;
2298+
$clone,
2299+
captionH = false;
22992300

23002301
$caption.toggleClass("fancybox-caption--separate", preventOverlap);
23012302

23022303
if (preventOverlap && caption && caption.length) {
23032304
if (current.pos !== self.currPos) {
2304-
$caption = $caption
2305-
.clone()
2306-
.empty()
2307-
.appendTo($caption.parent());
2305+
$clone = $caption.clone().appendTo($caption.parent());
23082306

2309-
$caption.html(caption);
2307+
$clone
2308+
.children()
2309+
.eq(0)
2310+
.empty()
2311+
.html(caption);
23102312

2311-
captionH = $caption.outerHeight(true);
2313+
captionH = $clone.outerHeight(true);
23122314

2313-
$caption.empty().remove();
2315+
$clone.empty().remove();
23142316
} else if (self.$caption) {
23152317
captionH = self.$caption.outerHeight(true);
23162318
}
@@ -2953,6 +2955,8 @@
29532955
.children()
29542956
.eq(0)
29552957
.html(caption);
2958+
} else {
2959+
self.$caption = null;
29562960
}
29572961

29582962
if (!self.hasHiddenControls && !self.isIdle) {

0 commit comments

Comments
 (0)