Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop scrolling onmouseOver?

Status
Not open for further replies.

kippie

Technical User
Nov 8, 2001
158
In the HTML below I use a script for horizontal image scrolling. Everything works fine, but the only thing is that I would like to stop the scrolling OnMouseOver of an image and that when the scrolling has stopped the user can click an image and is transferred to a certain HTML. So I would like to use the scrolling images as buttons. I have tried different things but I cannot get it working. Is there anyone who could help me with this timing?

This is the HTML I have so far:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"<html xmlns="<head>
<title>Image Scroller</title>
<base href=" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<style type="text/css">
/*<![CDATA[*/

body {
background: #ffffff;
overflow: hidden;
}

#container {




width:3600px; /*total images width */
display: none;
position: absolute;
top: 120px;
left: 0px;
border: solid 0px #6699cc;
}

.images {
float:left;
}

/*//]]>*/
</style>

<script type="text/javascript">
//<![CDATA[

var x = screen.width;
var w = 3550; /*total images width */
var i = 0;
var speed = 4;

function imageScroll() {
document.getElementById("container").style.display = "block";
document.getElementById("container").style.left = (x - i) + "px";
i++;
if(i >(x + w)) {
i = 0;
}
setTimeout("imageScroll()",speed);
}
onload = imageScroll;

//]]>
</script>

</head>
<body>

<div id = "container">
<img class = "images" src = "blindpianoopt.jpg" alt = ""/>
<img class = "images" src = "fredentedopt.jpg" alt = ""/>
<img class = "images" src = "koordanserkleinopt.jpg" alt = ""/>
<img class = "images" src = "blindpianoopt.jpg" alt = ""/>
</div>

</body>
</html>
 
Before I get too far into this, is it working basically correct now? When I run the code in IE, i creates an extremely wide page that continues to widen as the function executes (note the horizontal scroll bar growing and grwoing.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Hi, MWolf00,

Yes, the script is basically working correct. The only thing is that I would like to have it starting sooner and if possible in sight on the right hand side of the screen. Ast it is now it takes some time before the first image appears. But this is not so important.

Kippie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top