Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-19-2008, 04:01 PM   PM User | #1
Emachine
New to the CF scene

 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Emachine is an unknown quantity at this point
Fade in/out doesn't work in IE7

Hey, this code (a combination of Javascript and PHP) is working perfectly in FF, IE6, Opera, Safari and Seamonkey but doesn't work in IE7 for some reason. It's basically a slideshow wherein one picture fades out and to give way to another. In IE7 the pictures still flip but there's no fade. If anyone sees something I'm missing please let me know.
This should be all the code, if I'm missing some or if I've given too much let me know and I'll repost.

Thanks for the help ahead of time.

Code:
$_BANNERS = array(
	"m1.jpg",
	"m2.jpg",
	"m3.jpg",
	"m4.jpg",
	"m5.jpg",
	"m6.jpg",
	"m7.jpg",
	"m8.jpg",
	"m9.jpg",
	"m10.jpg",
);

$_FIX7 = false;
$_FIX = false;
$_r = strtolower(getenv('HTTP_USER_AGENT'));
if (strstr($_r, "windows")) {
	if (strstr($_r, "msie 6")) {
		$_FIX = true;
	}
	if(strstr($_r, "msie 7")){
		$_FIX7 = true;
	}
}

<script language="Javascript" type="text/javascript"><!--
	
	qN = 0;	

	banners = new Array();

<?
if ($REQUEST_URI == "/home_page/") {
	while (list($_k, $_v) = each($_BANNERS)) {
?>
	banners[<? print $_k; ?>] = '<? print $_v; ?>';
<?
	}
}
?>

function qU () {
	setTimeout('qL();', 3000);
}
function qL () {<?
	if ($_FIX) {
		print "\n\t";
		?>Layer('q2').src = '/i/' + banners[qN];
		Layer('q2').style.visibility = 'visible';<?
	}
	print "\n\t";
	?>
//	qY = Math.floor(Math.random()*banners.length);
	qY = qN + 1				//qN = index of $_BANNERS
//	if (qY == qN) {
//		qY = qN + 1;
		if (qY >= banners.length) {
			qY = 0;
		}
//	}
	Layer('q1').style.backgroundImage = 'url(/i/' + banners[qY] + ')';
	qN = qY;
	qM = 100;
	qR();
}
function qR () {
	qM = qM - 1;
	if (qM > 0) {
		if (qM < 10) {
			qV = '0' + qM;
		}
		else {
			qV = qM;
		}
		qTwo = Layer('q2');<?
		if ($_FIX) {
			print "\n\t\t";
			?>
			qTwo.style.filter="blendTrans(duration=2)";
			if (qTwo.filters.blendTrans.status != 2) {
				qTwo.filters.blendTrans.apply();
				qTwo.style.visibility="hidden";
				qTwo.filters.blendTrans.play();
			}
			qU();<?
		}
		else {
			?>qTwo.style.opacity = '.' + qV;
			qTwo.style.filter = 'alpha(opacity=' + banners[qN] + ')';
			setTimeout('qR();', 1);<?
		}
		print "\n\t";
	?>}
	else {
		Layer('q2').src = '/i/' + banners[qN];
		Layer('q2').style.opacity = '1.00';
		Layer('q2').style.filter = 'alpha(opacity=100)';
		qU();
	}
}
function Layer (name) {
		if (document.getElementById) {
			return document.getElementById(name);
		}
		if (document.all) {
			return document.all[name];
		}
		if (document.layers) {
			if (document.layers[name]) {
				return document.layers[name];
			}
			if (document[name]) {
				return document[name];
			}
		}
		return false;
	}
	function sL (n) {
		l = Layer(n)
		if (l) {
			l.style.visibility = '';
			l.style.display = '';
		}
	}
	function hL (n) {
		l = Layer(n)
		if (l) {
			l.style.visibility = 'hidden';
			l.style.display = 'none';
		}
	}
	function swapLayer (i) {
		for (n=5; n<=11; n++) {
			if (i == n) {
//				hL("y" + n);
				sL("d" + n);
				sL("x" + n);
			}
			else {
				hL("d" + n);
				hL("x" + n);
//				sL("y" + n);
			}
		}
	}
	
	
	
	
	
	pL = "";
	function sL2 (name) {
		if (pL != 'm' + name) {
			cL();
			l = Layer('m' + name);
			if (l) {
				pL = 'm' + name;
				i = getCoordinates('j' + name);
				l.style.top = i[0];
				l.style.left = i[1];
				l.style.visibility = '';
				l.style.display = '';
			}
		}
	}
	
	function cL () {
		if (pL.length > 0) {
			l = Layer(pL);
			if (l) {
				l.style.visibility = 'hidden';
				l.style.display = 'none';
				pL = "";
			}
		}
	}
Code:
<td id="q1" name="q1" height="1">
<img src="/i/<? print $_BANNERS[0]; ?>" id="q2" name="q2" width="1000" height="349" border="0" margin="0"></td>
Emachine is offline   Reply With Quote
Old 08-19-2008, 04:33 PM   PM User | #2
Emachine
New to the CF scene

 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Emachine is an unknown quantity at this point
You know what? I set $_FIX to true on "msie 7" as well and it fixed the problem. I had tried that earlier but I must have been viewing the cache or something.
Emachine is offline   Reply With Quote
Reply

Bookmarks

Tags
fade, ie7, opacity

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:56 PM.


Advertisement
Log in to turn off these ads.