html - silverlight 应用程序的浏览器滚动条问题。(Html)

标签 html css silverlight

我有一个简单的 silverlight 应用程序,我需要为其添加 Web 浏览器滚动条。 (滚动条不在我的 silverlight 应用程序中)

所以我有 html:

<style type="text/css">
html, body {
    height: 100%;
    overflow: auto;
}
body {
    padding: 0;
    margin: 0;
}
#silverlightControlHost {
    height: 100%;
    min-height:600px;
    min-width:800px;
    text-align:center;
}
</style><body>
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">       
      <param name="source" value="ClientBin/Infopulse.MobileOptimizer.xap"/>          
      <param name="onError" value="onSilverlightError" />
      <param name="background" value="white" />
      <param name="minRuntimeVersion" value="4.0.50401.0" />
      <param name="autoUpgrade" value="true" />       
      <param name="culture" value="ru-ru" />
      <param name="uiculture" value="ru-ru" />
      <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.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>
</form>
</body>

我遇到了下一个问题: 当启用滚动条时,垂直滚动条无法正常工作 silverlight 应用程序不适合页面内容。 (屏幕上的红色箭头显示没有 silverlight 应用程序的区域)我现在不知道如何解决这个问题。 宽度正常。内部 silverlight 应用程序内容设置为拉伸(stretch)

图片: Problem with scroll bars

如有任何信息,我将不胜感激

enter image description here

最佳答案

我们在 IE 和 Chrome 中遇到了同样的问题,并使用 Javascript 解决了它:

  1. 将以下 Javascript 添加到您的 Silverlight 测试页。

    window.onload = resizeObject;
    window.onresize = resizeObject;
    function resizeObject() {
        var height = document.getElementById('silverlightControlHost').offsetHeight;
        document.getElementById('silverlightObject').height = height;
    }
    
  2. 为您的 OBJECT 标记提供 ID“silverlightObject”。

    <object id="silverlightObject" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
    </object>
    
  3. 测试它。

关于html - silverlight 应用程序的浏览器滚动条问题。(Html),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4836656/

相关文章:

javascript - 从脚本中获取 true 或 false(来自 JSON 文件)以显示为复选框

html - 使用 CSS 对三个相等的框进行响应式垂直对齐

css - 样式达到最大值的 HTML5 进度标签

html - CSS - 试图删除网站上的空白

c# - 在 Silverlight 中存储应用程序设置

silverlight - 页面级别的用户授权

php - 如何在要设置大小的图像上叠加文字?

javascript - 使用 Animate.css 在 HTML 中制作多字动画

javascript - 限制div中元素的数量

c# - 如何将 'System.IO.IsolatedStorage.IsolatedStorageFileStream' 转换为 ImageSource?