克隆Silverlight嵌入对象会导致空白元素 [英] Cloning a silverlight embed object results in an empty white element

查看:113
本文介绍了克隆Silverlight嵌入对象会导致空白元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有一些Silverlight嵌入的对象。一个玩家可见,所有其他玩家都隐藏(显示:无)。当我单击缩略图时,代码将克隆相应的隐藏对象,并将可见的播放器替换为此克隆的对象。

I have a page with a few silverlight embed objects. One player is visible and all others are hidden (display: none). When I click a thumbnail the code clones the corresponding, hidden object and replaces the visible player with this cloned object.

此功能在Firefox,Chrome和IE9中可以正常使用,但在IE8中无法正常运行。可见播放器将被替换,但这会导致一个大的白色空Silverlight播放器。如果右键单击此白色元素,它将显示Silverlight上下文菜单,但仅此而已。控制台或其他任何提示均无错误。

This works fine in Firefox, Chrome and IE9, but in IE8 it doesn't work properly. The visible player gets replaced, but this results in a big white empty silverlight player. If you right-click this white element, it shows a silverlight context menu, but nothing else. No error in console or some other clue.

存在此问题的网站在线: http://www.vioranje.nl

在IE8中将其打开,然后单击标题栏 web afleveringen下方的播放按钮以查看会发生什么。

The website with this problem is online at: http://www.vioranje.nl
Open it in IE8 and click the play buttons underneath the titlebar "web afleveringen" to see what happens.

这是克隆Silverlight播放器(附加到缩略图的click事件处理程序)的jQuery代码:

This is the jQuery code that clones the Silverlight players (which is attached to the click event handlers of the thumbnails):

var embedType = (element.data().embedtype) ? element.data().embedtype : 'object';
var $embed = $element.find('.large .embed '+embedType);
var $newplayer = $(this).find('.embed');
var newplayerHTML = $newplayer.html();
var $newplayerInstance = $(newplayerHTML);
$embed.replaceWith($newplayerInstance);
$newplayerInstance.show();

我该怎么办才能解决此问题?

What can I do to resolve this problem?

推荐答案

我已经尝试调试您的情况,并且它看起来像IE8一样处理该标记并按如下所示对其进行重写:

I've tried to debug your case, and It seams like IE8 processes the tag and re-write it as the following:

<OBJECT data="data:application/x-oleobject;base64,QfXq3+HzJEysrJnDBxUISgAJAACuLQAAuh8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" width=442 type=application/x-silverlight-2 height=307 checkedByCssHelper="true"></OBJECT>

显然会丢失您传递给Silverlight视频播放器对象的参数。

Which apparently looses the Parameters you are passing to the Silverlight video player Object.

以下技巧可以帮助您解决所有浏览器的问题,
尝试使用a代替使用a来隐藏嵌入的标签,
通过使用tag。

Here is trick that might help you solving your issue for all browsers, Try to use a instead of using a to hide your embed tags, By using the tag .. your Silverlight Code will not be executed while its hidden, because it'll be treated as Text not as an HTML Code.

因此,在您的 HTML模板代码中,您的Silverlight代码在隐藏时将不会执行,因为它将被视为文本而不是HTML代码。 tpl_rtlxlvideo:

So in your HTML Template Code "tpl_rtlxlvideo":

替换:

<div class="embed" style="display: none;">{YOUR OBJECT TAG}</div>

使用:

<textarea class="embed" style="display: none;">{YOUR OBJECT TAG}</textarea>

对于 JavaScript端

替换:

var newplayerHTML = $newplayer.html();

使用:

var newplayerHTML = $newplayer.val();

希望对您有帮助:)

这篇关于克隆Silverlight嵌入对象会导致空白元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆