I have a div that holds a Silverlight object tag. From the code on some user action (click on a button) I am expanding the Div to total browser window. I am doing it through Jquery addClass and Remove class. In those classes the difference is position absolute , height width 100% and increased z-index.
It is running well in Ie7 and IE8. But while running through FF it is reloading the Xap when doing it. What can be the reason ? and any solution?
Thanks.
Edit: After some investigation it seems that the reason is because position:absolute. Changing position from relative to absolute is giving the problem. Also once I go from normal mode to fullscreen mode then normal mode. Then expanding it does not load it twice.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
SilverlightApplication1
<style type="text/css">
.slhost
{
width: 642px;
height: 500px;
position: relative;
}
.bigsl
{
width: 100%;
height: 100%;
position: absolute;
}
</style>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
function openOverlay() {
$("#silverlightControlHost").addClass("bigsl");
$("#silverlightControlHost").removeClass("slhost");
}
function closeOverlay() {
$("#silverlightControlHost").removeClass("bigsl");
$("#silverlightControlHost").addClass("slhost");
}
</script>
<UserControl x:Class="SilverlightApplication1.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:DesignWidth="640" d:DesignHeight="480">
< Grid x:Name="LayoutRoot" Background="Red" MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">
</Grid>
using System.Windows;
using System.Windows.Controls; using System.Windows.Input; using System.Windows.Browser;
namespace SilverlightApplication1 { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); Deployment.Current.Dispatcher.BeginInvoke(() => HtmlPage.Window.Alert("Application Loaded")); }
private bool _flip;
private void LayoutRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (_flip)
{
Deployment.Current.Dispatcher.BeginInvoke(() => HtmlPage.Window.Invoke("closeOverlay", null));
}
else
{
Deployment.Current.Dispatcher.BeginInvoke(() => HtmlPage.Window.Invoke("openOverlay", null));
}
_flip = !_flip;
}
}
}