Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
#marquee {
position:absolute;visibility:hidden;left:100px;top:100px;width:800px;height:100px;border:solid red 1px;
}
#marquee DIV {
visibility:visible;
}
#marquee2 {
position:absolute;left:100px;top:200px;width:100px;height:500px;border:solid red 1px;
}
/*]]>*/
</style></head>
<body>
<div id="marquee" onmouseover="zxcMarquee('marquee',0);" onmouseout="zxcMarquee('marquee',-1);" >
<div><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" width="100" /><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="image" width="100" /></div>
</div>
<div id="marquee2" onmouseover="zxcMarquee('marquee2',0);" onmouseout="zxcMarquee('marquee2',2);" >
<div><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" width="100" /><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="image" width="100" /></div>
</div>
<script type="text/javascript">
/*<![CDATA[*/
// Simple Marquee (09-November-2012)
// by Vic Phillips - http://www.vicsjavascripts.org.uk/
function zxcMarquee(id,spd,mde){
var o=zxcMarquee['zxc'+id],obj=document.getElementById(id),spd=typeof(spd)=='number'?spd:0;
if (obj&&!o){
var s=obj.getElementsByTagName('DIV')[0],clds=s.childNodes,lst=clds[clds.length-1],mde=mde=='top'?['top','offsetTop','offsetHeight']:['left','offsetLeft','offsetWidth'];
if (lst.nodeType!=1){
lst=lst.previousSibling;
}
obj.style.overflow='hidden';
s.style.position='absolute';
if (mde[0]=='left'){
s.style.width='30000px';
}
o=zxcMarquee['zxc'+id]={
mde:mde[0],
s:s,
sz:lst[mde[1]]+lst[mde[2]],
lft:s[mde[1]],
w:obj[mde[2]]
}
}
if (o){
o.lft+=spd;
if ((spd>0&&o.lft>o.w)||(spd<0&&o.lft<-o.sz)){
o.lft+=(o.w+o.sz)*(spd<0?1:-1);
}
o.s.style[o.mde]=o.lft+'px';
clearTimeout(o.to);
o.to=setTimeout(function(){ zxcMarquee(id,spd); },30);
}
}
zxcMarquee('marquee',-1);
zxcMarquee('marquee2',2,'top');
/*]]>*/
</script>
</body>
</html>
or maybe
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
#marquee {
position:absolute;visibility:hidden;left:20px;top:100px;width:800px;height:100px;border:solid red 1px;
}
#marquee DIV {
visibility:visible;
}
#marquee2 {
position:absolute;left:20px;top:300px;width:800px;height:100px;border:solid red 1px;
}
#marquee3 {
position:absolute;left:850px;top:20px;width:100px;height:500px;border:solid red 1px;
}
#marquee4 {
position:absolute;left:960px;top:20px;width:100px;height:500px;border:solid red 1px;
}
/*]]>*/
</style></head>
<body>
<div id="marquee" onmouseover="zxcMarquee('marquee',0);" onmouseout="zxcMarquee('marquee',-1);" >
<div><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" width="100" /><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="image" width="100" /></div>
</div>
<div id="marquee2" onmouseover="zxcMarquee('marquee2',0);" onmouseout="zxcMarquee('marquee2',-1);" >
<div><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" width="100" /><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="image" width="100" /></div>
</div>
<div id="marquee3" onmouseover="zxcMarquee('marquee3',0);" onmouseout="zxcMarquee('marquee3',2);" >
<div><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" width="100" /><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="image" width="100" /></div>
</div>
<div id="marquee4" onmouseover="zxcMarquee('marquee4',0);" onmouseout="zxcMarquee('marquee4',2);" >
<div><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="image" width="100" /><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="image" width="100" /></div>
</div>
<script type="text/javascript">
/*<![CDATA[*/
// Simple Marquee (09-November-2012)
// by Vic Phillips - http://www.vicsjavascripts.org.uk/
function zxcMarquee(id,spd,mde,fill){
var o=zxcMarquee['zxc'+id],obj=document.getElementById(id),spd=typeof(spd)=='number'?spd:0;
if (obj&&!o){
var s=obj.getElementsByTagName('DIV')[0],clds=s.childNodes,lst=clds[clds.length-1],mde=mde=='top'?['top','offsetTop','offsetHeight','left']:['left','offsetLeft','offsetWidth','top'],sz,fill=fill===true,nu,c,z0=1;
if (lst.nodeType!=1){
lst=lst.previousSibling;
}
obj.style.overflow='hidden';
s.style.position='absolute';
if (mde[0]=='left'){
s.style.width='30000px';
}
sz=lst[mde[1]]+lst[mde[2]];
if (fill){
nu=Math.ceil(obj[mde[2]]/sz)+1;
c=s.cloneNode(true);
for (;z0<nu;z0++){
c=c.cloneNode(true);
c.style[mde[0]]=sz*z0+'px';
c.style[mde[3]]='0px';
s.appendChild(c);
}
}
o=zxcMarquee['zxc'+id]={
mde:mde[0],
s:s,
sz:sz,
lft:s[mde[1]],
w:obj[mde[2]],
fill:fill
}
}
if (o){
o.lft+=spd;
if ((spd>0&&o.lft>(o.fill?0:o.w))||(spd<0&&o.lft<-o.sz)){
o.lft+=(o.fill?o.sz:(o.w+o.sz))*(spd<0?1:-1);
}
o.s.style[o.mde]=o.lft+'px';
clearTimeout(o.to);
o.to=setTimeout(function(){ zxcMarquee(id,spd); },30);
}
}
zxcMarquee('marquee',-1);
zxcMarquee('marquee2',1,'left',true);
zxcMarquee('marquee3',2,'top');
zxcMarquee('marquee4',-2,'top',true);
/*]]>*/
</script>
</body>
</html>
Bookmarks