[英]fancybox v2: How to change the position of title in the DOM?
如何将fancybox-image的标题设置为另一个DOM元素。 我不想在#fancybox-wrap
使用它。 我玩了以下jquery.fancybox.js
代码行1246
title = $('<div class="fancybox-title fancybox-title-' + opts.type + '-wrap">' + text + '</div>').appendTo('body');
通过更改.appendTo('body');
没有结果.appendTo('body');
?
我只想在另一个div
使用标题的输出。 你有什么建议吗? 谢谢-S
尝试在afterShow回调中添加它(fancybox 2):
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);
},
可能是每当启动fancybox时都可以尝试此操作。
$('#fancybox-wrap .fancybox-title').appendTo('anotherDomSelector');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.