Page 1 of 1

How to create a float ads which move slowly

Posted: Sun Apr 15, 2007 3:27 am
by hoangvu.che
I have created a float ads which moves along the page scrolling.
However, I can not make it move smoothly as you can see a similar ads in this page

http://www.dantri.com.vn

Moreover, the float ads is not displayed in IE 7.0

Here is my code:

Code: Select all

  <script type="text/javascript" language="JavaScript"><!-- Copyright 2001 William Bontrager
var Type = 'Z';
function StartFloat() {
if(document.all) {
	document.all.AdFloater.style.pixelLeft = document.body.clientWidth - document.all.AdFloater.offsetWidth;
	document.all.AdFloater.style.visibility = 'visible';
	Type = 'A';
	}
else if(document.layers) {
	document.AdFloater.left = window.innerWidth - document.AdFloater.clip.width - 16;
	document.AdFloater.visibility = 'show';
	Type = 'B';
	}
else if(document.getElementById) {
	document.getElementById('AdFloater').style.left = (window.innerWidth - 130) + 'px';
	document.getElementById('AdFloater').style.visibility = 'visible';
	Type = 'C';
	}
if (document.all) { alert('onscroll');window.onscroll = Float; }
else { setInterval('Float()', 100); }
}
function Float() {
if (Type == 'A') { document.all.AdFloater.style.pixelTop = document.body.scrollTop; }
else if (Type == 'B') { document.AdFloater.top = window.pageYOffset; }
else if (Type == 'C') { 	
	document.getElementById('AdFloater').style.top = window.pageYOffset + 'px';
}
} //-->
Besides, I put a

Code: Select all

<span id="AdFloater" style="position: absolute; visibility: hidden; top: 1px;" align="right"><img src=""></span>
tag right before </body> tag

Could you help me with the above prolems?

Posted: Sun Apr 15, 2007 3:45 am
by Ollie Saunders
Jebus! Lose the smooth scroll and just have it stick for gods sake!

Code: Select all

position:fixed;
may be of interest.