[英]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.