2011-08-02 11 views
3

誰かがこれに対して簡単に修正を見つけたのか疑問に思うでしょう。 Silverlightオブジェクトの幅/高さを100%として使用し、FIrefoxでコンテナdivの高さと幅をアニメーション化することで、Silverlightのサイズを制御できないように見えます。誰かがそれに対する回避策を見つけたのかどうか疑問に思っていた。かなりイライラして、次のものはFirefox以外のすべてのブラウザでうまく動作します。Silverlightコンテナdivのサイズを変更すると、SilverlightがFirefoxでリロードされます。

Firefoxでテストをクリックすると、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> 

答えて

1

これは、jQueryアニメーションによってコンテナのオーバーフローが変更され、シルバーライトがリロードされるためです。 firefox上のディスプレイやコンテナの位置を変更すると、同様のことが起こる可能性があります。 これは、jQuery 1.6.4の8266行(1.5行後の他のバージョンに近いかもしれない)のコメント行を解凍しました。
this.style.overflow = "hidden";
これが役に立ちます。
Marcos。

関連する問題