我试图重置由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