【发布时间】:2012-01-30 01:29:58
【问题描述】:
我正在尝试使用 fancybox 2 的图像 alt 标签中的标题和“标题”...由于某种原因,我似乎无法正常工作...
$('.fancybox').fancybox({
beforeShow : function() {
this.title = '<div class="new-title-title">' + $(this).attr('title') + '</div><div class="new-title-alt">' + $(this).children('img:first').attr('alt') + '</div>';
},
helpers : {
title: {
type: 'inner',
beforeShow: function(opts) {
console.log('beforeShow title helper');
},
},
},
});
来自 $(this).attr('title') 的标题工作,来自 $(this).children('img:first').attr('alt') 的标题说未定义...我知道我必须是缺少一些简单的东西......
【问题讨论】:
标签: javascript jquery fancybox