L
Laurent Compere
Hi all,
I try to make a logo fade in. I wrote the code below that is simple and
supposed to be compatible with IE6,Firefox and Netscape.
It works pretty well under IE6 but under Firefox and Netscape, I have the
same problem : It seems that the property MozOpacity doesn't want to update
itself though I cand read its value with the same object reference. Can
Anybody try to explain me why ? As a log, I sent several values on the
status bar (see code below). Under Firefox and Netscape, The counter
increments like it should but the opacity still remains the same (not
updated) then I have an infinite loop ...
Thanks for your help ...
----------------------------------------------------
<html>
<head>
<title>Perfect Design</title>
<script src="scripts/splash.js"></script>
<script src="scripts/browserCheck.js"></script>
<link type="text/css" rel="stylesheet" href="styles/splash.css">
</head>
<body onLoad="init()">
<div class="centerBox">
<div class="sousimage">
<img name="fond" src="images/Logo1a.jpg" width="600" height="450">
</div>
<div class="surimage">
<img name="logo" src="images/Logo1b.gif" style="-moz-opacity: -0.05;
filter: progidXImageTransform.Microsoft.Alpha(opacity=0);">
</div>
</div>
</body>
</html>
----------------------------------------------------
//<!--
function init() {
window.status = "IE6UP ? " + is_ie6up + " NAV6UP ? " + is_nav6up + " MOZ ?
" + is_moz + " IS_GECKO ? " + is_gecko;
simplePreload( 'images/Logo1a.jpg', 'images/Logo1b.gif' );
setTimeout("increaseOpacity()",150);
}
var i;
function increaseOpacity() {
i = 0;
if (is_ie6up) {
window.status = "ISIE6UP";
increaseOpacityIE();
}
else if (is_nav6up || is_gecko) {
window.status = "ISNAV6UP OU ISGECKO";
increaseOpacityNS();
}
}
function increaseOpacityNS() {
if (document.logo.style.MozOpacity < 1) {
document.logo.style.MozOpacity += 0.05;
window.status = (i++) + ". GECKO opacity = " +
document.logo.style.MozOpacity;
setTimeout('increaseOpacityNS()',150);
}
}
function increaseOpacityIE() {
if (document.logo.filters.item("DXImageTransform.Microsoft.Alpha").opacity
< 100) {
document.logo.filters.item("DXImageTransform.Microsoft.Alpha").opacity +=
5;
window.status = (i++) + ". IE6 opacity = " +
document.logo.filters.item("DXImageTransform.Microsoft.Alpha").opacity;
setTimeout("increaseOpacityIE()",150);
}
}
function simplePreload()
{
var args = simplePreload.arguments;
document.imageArray = new Array(args.length);
for(var i=0; i<args.length; i++)
{
document.imageArray = new Image;
document.imageArray.src = args;
}
}
//-->
I try to make a logo fade in. I wrote the code below that is simple and
supposed to be compatible with IE6,Firefox and Netscape.
It works pretty well under IE6 but under Firefox and Netscape, I have the
same problem : It seems that the property MozOpacity doesn't want to update
itself though I cand read its value with the same object reference. Can
Anybody try to explain me why ? As a log, I sent several values on the
status bar (see code below). Under Firefox and Netscape, The counter
increments like it should but the opacity still remains the same (not
updated) then I have an infinite loop ...
Thanks for your help ...
----------------------------------------------------
<html>
<head>
<title>Perfect Design</title>
<script src="scripts/splash.js"></script>
<script src="scripts/browserCheck.js"></script>
<link type="text/css" rel="stylesheet" href="styles/splash.css">
</head>
<body onLoad="init()">
<div class="centerBox">
<div class="sousimage">
<img name="fond" src="images/Logo1a.jpg" width="600" height="450">
</div>
<div class="surimage">
<img name="logo" src="images/Logo1b.gif" style="-moz-opacity: -0.05;
filter: progidXImageTransform.Microsoft.Alpha(opacity=0);">
</div>
</div>
</body>
</html>
----------------------------------------------------
//<!--
function init() {
window.status = "IE6UP ? " + is_ie6up + " NAV6UP ? " + is_nav6up + " MOZ ?
" + is_moz + " IS_GECKO ? " + is_gecko;
simplePreload( 'images/Logo1a.jpg', 'images/Logo1b.gif' );
setTimeout("increaseOpacity()",150);
}
var i;
function increaseOpacity() {
i = 0;
if (is_ie6up) {
window.status = "ISIE6UP";
increaseOpacityIE();
}
else if (is_nav6up || is_gecko) {
window.status = "ISNAV6UP OU ISGECKO";
increaseOpacityNS();
}
}
function increaseOpacityNS() {
if (document.logo.style.MozOpacity < 1) {
document.logo.style.MozOpacity += 0.05;
window.status = (i++) + ". GECKO opacity = " +
document.logo.style.MozOpacity;
setTimeout('increaseOpacityNS()',150);
}
}
function increaseOpacityIE() {
if (document.logo.filters.item("DXImageTransform.Microsoft.Alpha").opacity
< 100) {
document.logo.filters.item("DXImageTransform.Microsoft.Alpha").opacity +=
5;
window.status = (i++) + ". IE6 opacity = " +
document.logo.filters.item("DXImageTransform.Microsoft.Alpha").opacity;
setTimeout("increaseOpacityIE()",150);
}
}
function simplePreload()
{
var args = simplePreload.arguments;
document.imageArray = new Array(args.length);
for(var i=0; i<args.length; i++)
{
document.imageArray = new Image;
document.imageArray.src = args;
}
}
//-->