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

Commit

Permalink
Updated to v3.5.5
Browse files Browse the repository at this point in the history
- Fixed #2150 - Caption is not cleared
  • Loading branch information
fancyapps committed Dec 13, 2018
1 parent f5e272a commit 4658124
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
26 changes: 15 additions & 11 deletions dist/jquery.fancybox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==================================================
// fancyBox v3.5.4
// fancyBox v3.5.5
//
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
Expand Down Expand Up @@ -2303,24 +2303,26 @@
var self = this,
current = slide || self.current,
caption = current.opts.caption,
preventOverlap = current.opts.preventCaptionOverlap,
$caption = self.$refs.caption,
captionH = false,
preventOverlap = current.opts.preventCaptionOverlap;
$clone,
captionH = false;

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

if (preventOverlap && caption && caption.length) {
if (current.pos !== self.currPos) {
$caption = $caption
.clone()
.empty()
.appendTo($caption.parent());
$clone = $caption.clone().appendTo($caption.parent());

$caption.html(caption);
$clone
.children()
.eq(0)
.empty()
.html(caption);

captionH = $caption.outerHeight(true);
captionH = $clone.outerHeight(true);

$caption.empty().remove();
$clone.empty().remove();
} else if (self.$caption) {
captionH = self.$caption.outerHeight(true);
}
Expand Down Expand Up @@ -2963,6 +2965,8 @@
.children()
.eq(0)
.html(caption);
} else {
self.$caption = null;
}

if (!self.hasHiddenControls && !self.isIdle) {
Expand Down Expand Up @@ -3046,7 +3050,7 @@
});

$.fancybox = {
version: "3.5.4",
version: "3.5.5",
defaults: defaults,

// Get current instance and execute a command.
Expand Down
6 changes: 3 additions & 3 deletions dist/jquery.fancybox.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fancyapps/fancybox",
"description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
"version": "3.5.4",
"version": "3.5.5",
"homepage": "https://fancyapps.com/fancybox/3/",
"main": "dist/jquery.fancybox.js",
"style": "dist/jquery.fancybox.css",
Expand Down
22 changes: 13 additions & 9 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2293,24 +2293,26 @@
var self = this,
current = slide || self.current,
caption = current.opts.caption,
preventOverlap = current.opts.preventCaptionOverlap,
$caption = self.$refs.caption,
captionH = false,
preventOverlap = current.opts.preventCaptionOverlap;
$clone,
captionH = false;

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

if (preventOverlap && caption && caption.length) {
if (current.pos !== self.currPos) {
$caption = $caption
.clone()
.empty()
.appendTo($caption.parent());
$clone = $caption.clone().appendTo($caption.parent());

$caption.html(caption);
$clone
.children()
.eq(0)
.empty()
.html(caption);

captionH = $caption.outerHeight(true);
captionH = $clone.outerHeight(true);

$caption.empty().remove();
$clone.empty().remove();
} else if (self.$caption) {
captionH = self.$caption.outerHeight(true);
}
Expand Down Expand Up @@ -2953,6 +2955,8 @@
.children()
.eq(0)
.html(caption);
} else {
self.$caption = null;
}

if (!self.hasHiddenControls && !self.isIdle) {
Expand Down

0 comments on commit 4658124

Please sign in to comment.