【发布时间】:2011-08-02 00:23:24
【问题描述】:
想知道是否有人找到了解决此问题的简单方法。您似乎无法通过在 Silverlight 对象上使用 100% 的宽度/高度来控制 Silverlight 的大小,然后在 FIrefox 中为容器 div 的高度和宽度设置动画。我想知道是否有人找到了解决方法。令人沮丧的是,以下内容在除 Firefox 之外的所有浏览器中都可以正常工作。
当您在 Firefox 中单击测试时,您可以看到 Silverlight 控件消失并且 Silverlight 对象必须重新加载自身。在其他浏览器中,它不必重新加载并且动画效果很好。为什么选择火狐,为什么?现在我不得不恨你。
UserControl x:Class="testFirefox.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Border BorderThickness="4" BorderBrush="Black">
<Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Center" FontSize="30"></TextBlock>
</Grid>
</Border>
</UserControl>
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>testFirefox</title>
<script type="text/javascript" src="Silverlight.js"></script>
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#testSilverlight").click(function () {
$("#silverlightControlHost").animate({ width: 700 }, 2000, 'swing');
});
});
</script>
</head>
<body>
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost" style="height:300px; width: 300px;">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/testFirefox.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
<div id="testSilverlight" style="height:50px; width:50px; border: 1px solid black;">
TEST
</div>
</form>
</body>
</html>
【问题讨论】:
标签: jquery silverlight firefox