Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 调整Silverlight容器div的大小使Silverlight在Firefox中重新加载_Jquery_Silverlight_Firefox - Fatal编程技术网

Jquery 调整Silverlight容器div的大小使Silverlight在Firefox中重新加载

Jquery 调整Silverlight容器div的大小使Silverlight在Firefox中重新加载,jquery,silverlight,firefox,Jquery,Silverlight,Firefox,想知道是否有人找到了一个简单的解决办法。似乎无法通过在Silverlight对象上使用100%的宽度/高度,然后在FIrefox中设置容器div高度和宽度的动画来控制Silverlight的大小。我想知道是否有人找到了解决办法。非常令人沮丧的是,除了Firefox之外,以下功能在所有浏览器中都可以正常工作 您可以看到,当您在Firefox中单击test时,Silverlight控件消失,Silverlight对象必须重新加载自身。在其他浏览器中,它不需要重新加载,只需设置动画即可。为什么是Fir

想知道是否有人找到了一个简单的解决办法。似乎无法通过在Silverlight对象上使用100%的宽度/高度,然后在FIrefox中设置容器div高度和宽度的动画来控制Silverlight的大小。我想知道是否有人找到了解决办法。非常令人沮丧的是,除了Firefox之外,以下功能在所有浏览器中都可以正常工作

您可以看到,当您在Firefox中单击test时,Silverlight控件消失,Silverlight对象必须重新加载自身。在其他浏览器中,它不需要重新加载,只需设置动画即可。为什么是Firefox,为什么?现在我不得不恨你了

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>
用户控件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”> testFirefox $(文档).ready(函数(){ $(“#testSilverlight”)。单击(函数(){ $(“#silverlightControlHost”).animate({width:700},2000,'swing'); }); }); 试验
之所以发生这种情况,是因为jQuery animate更改了容器的溢出,导致silverlight重新加载。当您更改firefox上容器的显示或位置时,可能会发生类似的情况。 我在jQuery1.6.4的第8266行(这一行可能在1.5之后的其他版本上比较接近)未压缩版本中说明了
时解决了这个问题 this.style.overflow=“hidden”;
希望这能有所帮助。
马科斯