Jquery fancybox v2:如何更改标题在DOM中的位置?
如何将fancybox图像的标题设置到另一个DOM元素中。我不想在Jquery fancybox v2:如何更改标题在DOM中的位置?,jquery,fancybox,Jquery,Fancybox,如何将fancybox图像的标题设置到另一个DOM元素中。我不想在#fancybox wrap中使用它。我使用了jquery.fancybox.js title=$(''+text+'').appendTo('body') 更改.appendTo('body')没有结果 我只想在另一个div中使用标题的输出。你有什么建议吗? 谢谢-可能您可以在启动fancybox时尝试此功能 $('#fancybox-wrap .fancybox-title').appendTo('anotherDomSele
#fancybox wrap
中使用它。我使用了jquery.fancybox.js
title=$(''+text+'').appendTo('body')代码>
更改.appendTo('body')没有结果代码>
我只想在另一个div
中使用标题的输出。你有什么建议吗?
谢谢-可能您可以在启动fancybox时尝试此功能
$('#fancybox-wrap .fancybox-title').appendTo('anotherDomSelector');
尝试在afterShow回调(fancybox 2)中添加此选项:
afterShow:function(){
var iframe=this.internal.children(document.contents();
var body=iframe.find('body');
var iframetTitle=this.title;
body.find('.your container div').append(''+iframetTitle+'');
console.log(iframetTitle);
},
beforeShow:function(){$('#fancybox wrap.fancybox title')。appendTo('#hier');}否-不起作用。能否检查警报($('#fancybox wrap.fancybox title')。长度)
insidebeforeShow
handler?您的选择器错误,我看到您刚才提供的链接上没有id为fancybox wrap
的元素。感谢您的支持-现在它可以使用:onUpdate:function(){$('.fancybox title')。appendTo('#hier')}
afterShow: function(){
var iframe = this.inner.children(document).contents();
var body = iframe.find('body');
var iframeTitle = this.title;
body.find('.your-container-div').append('<h1>'+iframeTitle+'</h1>');
console.log(iframeTitle);
},