简体   繁体   English

带有SWF后备的HTML5 Swiffy

[英]HTML5 Swiffy with a Swf Fallback

I have a .swf-to-Swiffy HTML5 banner and would like to create a .swf fallback for IE. 我有一个.swf-to-Swiffy HTML5横幅广告,并想为IE创建一个.swf后备广告。 What is the proper way to do this? 正确的方法是什么? I currently have the Swiffy inside an iframe (yikes). 我目前在iframe中有Swiffy(喜欢)。

There is a blog post here that may help http://www.malphursinteractive.com/flash-to-html5-fallback/ 这里有一篇博客文章可能会对http://www.malphursinteractive.com/flash-to-html5-fallback/

Essentially the idea is to use CSS conditionals to load the relevant javascript depending on the browser eg 本质上,这个想法是根据浏览器使用CSS条件加载相关的javascript,例如

    <!--[if !IE]> -->
        <script type="text/javascript" src="javascripts/swiffy.js"></script> 
        <script type="text/javascript" src="javascripts/animation.js"></script>
    <!-- <![endif]-->

    <!--[if IE]>
        <script type="text/javascript" src="javascripts/swfobject.js"></script>
        <script type="text/javascript">
            swfobject.embedSWF("images/animation.swf", "swiffycontainer", "300", "390", "9.0.115");
        </script>
    <![endif]-->

The 'swiffy.js' is the Google Swiffy library, the 'animation.js' contains the specific animation javascript created by exporting Flash to Swiffy. “ swiffy.js”是Google Swiffy库,“ animation.js”包含通过将Flash导出到Swiffy而创建的特定动画javascript。 These are loaded for NON IE browsers. 这些是为NON IE浏览器加载的。

The 'swfobject.js' is loaded and embed code is run for IE browsers to display a Flash fallback. 加载swfobject.js并为IE浏览器运行嵌入代码,以显示Flash后备。

You then have a div in your page to hold the animation and target it with the 'swfobject.embedSWF' code. 然后,页面中将有一个div来保存动画,并使用“ swfobject.embedSWF”代码将其定位。

<div id="swiffycontainer"></div>

You can also provide a Non flash fallback with CSS eg 您还可以使用CSS提供非Flash后备功能,例如

#swiffycontainer{
 width: 300px;
 height: 390px;
 background: url('../images/animation.gif') no-repeat no-repeat;
 background-position: center center;

} }

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM