The problem:
For a project we were trying to make a Drupal based site a bit more attractive, by adding a full screen flash background.
The SWF had to scale with the browserwindow - and stay fixed in the window during scolling.
The solution:
HTML:
Make sure the flash div comes first - otherwise it won’t work.
since this solution doesn’t work in IE6 (go figure) - we only embed the swf when your browser is greater than IE6
<!--[if gt IE 6]><!--> <div id="flash"> place your swf here </div> <!--><![endif]--> <div id="wrapper"> your sites content </div>
Â
CSS:
We position the flash div fixed to the upper left corner of the . This way the flash stays on the same place while scrolling.
The Z-indexes make sure the Flash div is positioned behind the website content.
#flash {
background-color: #000000;
height: 100%;
position: fixed;
top: 0;
width: 100%;
z-index: 0;
}
#wrapper {
position: relative;
z-index: 1;
}
Further issues:
- doesn’t work in IE6
- no mouse pointer in Safari when hovering over links (even when added in CSS)
#1 by kyoji - May 15th, 2009 at 01:45
I tried to build a page in this way, but my flash comes above my content (Test in FF, IE8). Any idea? or can you guy put on a online demo here? Thanks in advance.
#2 by Tim - May 15th, 2009 at 08:58
kyoji, you can take a look at our website for an online example: http://www.calibrate.be
#3 by Alvin - August 11th, 2009 at 03:09
Would it be possible to load a slideshow instead of a single image?
#4 by rob - August 16th, 2009 at 17:21
Adjust the way you request your background swf:
var so = new SWFObject(”/sites/all/misc/background.swf”, “flash-background”, “100%”, “100%”, “6″);
so.addParam(”movie”, “/sites/all/misc/background.swf”);
so.addParam(”quality”, “high”);
so.addParam(”wmode”, “transparent”);
so.addVariable(”img”, “/sites/all/misc/back.jpg”);
It’s the sizes (1oo%) and the “wmode” (transparent).
it works great! Thanks.
so.write(”flash-container”);
#5 by Eric - December 9th, 2009 at 13:03
Your website looks good but the flash background does not work on Safari (windows) - it sits ontop of everything and IE6 - the flash background just does not load… works fine for FF, Crome, Opera, IE8
#6 by Justin Washburn - December 17th, 2009 at 02:20
Could you put up a tutorial for the newbies?