我試圖重置由jQuery Cycle Plugin提供動力的Flash內容。jQuery replaceWith()麻煩
我想要做什麼:
- 更換每一個 「.flash」 在以前的 「.slide」 與空div,
- 頂替創建空div與以前.flash數據。
我知道這聽起來很愚蠢,但它的復位工作的Flash內容的一個驚人的方式,最好的選擇(刪除和附加),導致了大量的造型問題,我不希望使用任何swfobject.js和其他API。當然,隱藏也不是一種選擇。
使用Cycle Plugin提供的「after」回調可以完美地工作,但不知何故,我無法檢索原始的.flash內容,我的回調函數的最後一行沒有任何效果,.flash被替換爲空div永久:
jQuery("#slider").cycle({
after: callbackAfter,
});
function callbackAfter(){
var FlashContent = jQuery(this).prev('.slide').find('.flash'); //find any flash content in previous slide
var FlashContentHolder = jQuery("<div></div>"); //place empty div instead
FlashContent.replaceWith(FlashContentHolder); //replace the flash content with empty div
FlashContent.replaceWith(FlashContent); //This doesn't work - replace the empty div with stored flash content
}
的問題是,不顯示原始FlashContent的最後一行。
我試圖設置FlashContent & FlashContentHolder變量開始改變範圍的功能,但是這不是重點,我想,第一行是問題,因爲我刪除的東西,然後尋找它,所以我沒有得到任何回報?
此功能,準確地做什麼,我需要(但不顯示.flash在原來的位置的視頻,我不能用絕對定位):
function callbackAfter(){
var stopFlash = jQuery(this).prev('div').find('.flash').remove();
jQuery(this).prev('div').append(stopFlash);
}
這其實小問題工作(往上看)。
有什麼建議嗎?
你免去您的存儲'FlashContent'閃光燈用空白的div調用'FlashContent.replaceWith(FlashContentHolder)當內容' – 2012-01-04 19:45:47