【问题标题】:Responsive sized swfobject?响应大小的swfobject?
【发布时间】:2015-09-06 14:23:17
【问题描述】:

我已将此交互式海报 (http://www.mikesmithdesign.co.uk/images/posterforscreen.swf) 嵌入到 html 页面中,但无法设置其大小。我正在使用引导程序并希望内容具有响应性,但目前它出现在列的中间非常小,我似乎无法让它填满整个宽度。我尝试将宽度和高度设置为 100 % 或使用“img-responsive”类,但似乎没有任何效果。这是我的代码:

      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <script type="text/javascript" src="swfobject.js"></script>
      <script type="text/javascript">
         swfobject.registerObject("myFlashContent", "9.0.0");
      </script>

以及正文中的代码(忽略未闭合的 div 标签,因为这只是代码的 sn-p,而不是全部)

<div class="col-md-8 col-md-offset-1 visible-md visible-lg" id="mainContent">
  <img src="images/typesketch.jpg" alt="Typographic Development Sketches" class="img-responsive propersize" />
  <br />
  <br />
  <div>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="myFlashContent">
      <param name="movie" value="posterforscreen.swf">
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="posterforscreen.swf" class="propersize">
        <!--<![endif]-->
        <a href="http://www.adobe.com/go/getflashplayer">
          <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
        </a>
        <!-- [if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
  </div>

请原谅任何乱七八糟的代码或不良做法,我的背景是印刷设计,所有这些网络内容对我来说有点新。

【问题讨论】:

  • 要调整swf对象的大小,可以将其widthheight设置为100%,然后可以根据需要调整其父div的大小。
  • 我的问题是你到底在哪里设置高度和宽度?在头上?体内?还是在 CSS 中?
  • 尝试使用img-responsive propersize 类,正如我在this page 中看到的那样。如果您有一个在线可见页面,如果我们可以直接看到使用的代码,那将更容易为您提供帮助。
  • 我确实尝试过使用它们,但不确定将它们分配到哪里。是给父div吗?在对象标签内?我在此处发布了该页面的试用版:mikesmithdesign.co.uk/testpage,如果它可以帮助您理解的话。再次原谅任何凌乱的代码,对我来说仍然有点新。感谢到目前为止的帮助。
  • 我只想对桌面布局做出响应,一旦它达到平板电脑和移动设备的尺寸,它就会切换到它的非交互式版本,因为不支持 Flash

标签: twitter-bootstrap flash responsive-design swfobject


【解决方案1】:

要修复你的flash对象的height,你可以根据页面的大小使用你的图片的height,这给了我们:

CSS 代码:

<style>

    @media (min-width: 1200px) {
        .flash_container {
            height: 499px;
        }
    }

    /* Landscape tablets and medium desktops */
    @media (min-width: 992px) and (max-width: 1199px) {
        .flash_container {
            height: 410px;
        }
    }

    /* we don't need all these presets 
       because you are showing an image 
       instead of the flash object 
    */

    /* Portrait tablets and small desktops */
    @media (min-width: 768px) and (max-width: 991px) {}

    /* Landscape phones and portrait tablets */
    @media (max-width: 767px) {}

    /* Portrait phones and smaller */
    @media (max-width: 480px) {}

</style>

HTML 代码:

<div class="img-responsive propersize flash_container">  
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="myFlashContent" width="100%" height="100%">
        <param name="movie" value="posterforscreen.swf">
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="posterforscreen.swf" width="100%" height="100%">
        <!--<![endif]-->
        <a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"></a>
        <!-- [if !IE]>-->
        </object>
        <!--<![endif]-->
    </object>
</div>

希望能有所帮助。

【讨论】:

猜你喜欢
  • 2012-04-08
  • 1970-01-01
  • 2020-12-21
  • 2012-05-15
  • 1970-01-01
  • 2010-10-31
  • 2021-01-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多