Skip to content

Commit 72242d2

Browse files
committed
Restore custom fancybox code
1 parent 5a88264 commit 72242d2

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

assets/js/jquery.fancybox.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3202,9 +3202,32 @@
32023202
if (props.width !== undefined) {
32033203
css.width = props.width;
32043204
}
3205+
3206+
var custom_caption_outerHeight = 0;
32053207

3206-
if (props.height !== undefined) {
3207-
css.height = props.height;
3208+
if($('.fancybox-custom-caption.inside-caption').length ){
3209+
custom_caption_outerHeight = $el.find('.fancybox-custom-caption').outerHeight();
3210+
if(custom_caption_outerHeight == 0){
3211+
custom_caption_outerHeight = 10;
3212+
}
3213+
} else {
3214+
custom_caption_outerHeight = ($el.find('.fancybox-image').outerHeight() - $el.find('.fancybox-image').height())/2;
3215+
// Seems like different border width for image requires a little trimming
3216+
if(custom_caption_outerHeight > 20 && custom_caption_outerHeight < 25 ){
3217+
custom_caption_outerHeight -= 2;
3218+
}
3219+
3220+
if(custom_caption_outerHeight >= 25 && custom_caption_outerHeight <= 30){
3221+
custom_caption_outerHeight -= 4;
3222+
}
3223+
3224+
if(custom_caption_outerHeight > 30){
3225+
custom_caption_outerHeight -= 6;
3226+
}
3227+
}
3228+
3229+
if (props.height !== undefined && props.height != $el.outerHeight()) {
3230+
css.height = props.height + custom_caption_outerHeight;
32083231
}
32093232

32103233
return $el.css(css);

readme.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: silkalns
33
Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
44
Requires at least: 4.6
55
Tested up to: 5.6
6-
Stable tag: 3.3.1
6+
Stable tag: 3.3.2
77
License: GPLv3 or later
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -31,7 +31,7 @@ If you enjoy using FancyBox lightbox for WordPress please leave a [positive feed
3131

3232
== Changelog ==
3333
- 3.3.2 =
34-
Upgrade Fancybox to latest version ( https://github.com/ColorlibHQ/fancybox-for-wordpress/issues/95 )
34+
Changed: Upgrade Fancybox to latest version ( https://github.com/ColorlibHQ/fancybox-for-wordpress/issues/95 )
3535

3636
= 3.3.0 =
3737
Compatibility with jQuery 3.0

0 commit comments

Comments
 (0)