Skip to content

Commit d5d68e5

Browse files
committed
#45 fix for inside title position
1 parent 0516f36 commit d5d68e5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

assets/js/jquery.fancybox.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3178,8 +3178,14 @@
31783178
css.width = props.width;
31793179
}
31803180

3181+
var custom_caption_outerHeight = 0;
3182+
3183+
if($('.fancybox-custom-caption.inside-caption').length ){
3184+
custom_caption_outerHeight = $el.find('.fancybox-custom-caption').outerHeight();
3185+
}
3186+
31813187
if (props.height !== undefined) {
3182-
css.height = props.height;
3188+
css.height = props.height + custom_caption_outerHeight;
31833189
}
31843190

31853191
return $el.css(css);

fancybox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ function mfbfw_init() {
221221
if(caption && title){jQuery(this).attr("title",title+" " + caption)}else if(title){ jQuery(this).attr("title",title);}else if(caption){jQuery(this).attr("title",caption);}
222222
}); ';
223223

224-
224+
$afterLoad = '';
225225
if ( $mfbfw['titlePosition'] == 'inside' ) {
226226
$afterLoad = 'function( instance, current ) {';
227-
$afterLoad .= 'current.$content.append(\'<div class=\"fancybox-custom-caption\" style=\" position: absolute;left:0;right:0;color:#000;padding-top:10px;bottom:-50px;margin:0 auto;text-align:center;background-color:'.$mfbfw['paddingColor'].' \">\' + current.opts.caption + \'</div>\');';
227+
$afterLoad .= 'current.$content.append(\'<div class=\"fancybox-custom-caption inside-caption\" style=\" position: absolute;left:0;right:0;color:#000;margin:0 auto;bottom:0;text-align:center;background-color:'.$mfbfw['paddingColor'].' \">\' + current.opts.caption + \'</div>\');';
228228
$afterLoad .= '}';
229229
$hideCaption = 'div.fancybox-caption{display:none !important;}';
230230
} else if ( $mfbfw['titlePosition'] == 'over' ) {

0 commit comments

Comments
 (0)