【问题标题】:Resizing Silverlight container div makes Silverlight reload in Firefox调整 Silverlight 容器 div 的大小使 Silverlight 在 Firefox 中重新加载
【发布时间】: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


    【解决方案1】:

    这是因为 jQuery animate 改变了容器的溢出导致 silverlight 重新加载。当您在 Firefox 上更改容器的显示或位置时,可能会发生类似的情况。 我已经解决了这个评论 jQuery 1.6.4 的第 8266 行(该行可能在 1.5 之后的其他版本附近)未压缩版本,上面写着
    this.style.overflow = "隐藏";
    希望这会有所帮助。
    马科斯。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-16
      • 2011-08-29
      • 1970-01-01
      • 2011-09-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多