...

View Full Version : link menu script



misscali
06-27-2004, 02:11 AM
I'm having problems with my script for a link menu. There is a image behind them that moves across them. I have two lines of links so It would be really cool to have the image go down to the second line (which is right below it) and then go back that way. Like a
__
__| sort of track. I had no idea how to do it, so I tried to just make two lines seperate with their own images, but for some reason the second image doesn't go across. Does anyone know how to do either one of these things? my page that I put it on is http://california.bravehost.com/a%20temp.html if that's any help. Also, just a minor problem, I can't seem to figure out how to raise the image a tiny bit without making the position fixed. Any help would be great, thanks.

SpiritualStorms
06-27-2004, 07:15 AM
I would like to look at the script. Could you break down into their main pieces the main structure of the code?

I my think is that if you can make the image move in the first place, then its just an issue of then controlling the direction. This assumes that you can basically create 2 addtional variables that will control the stopping points of the image's movement. So one way would be to go from point A to point B, then from point B to point C, and then from point C, to point D, and then back on its regular course.

misscali
06-27-2004, 06:33 PM
ok that makes sence. I'm new to javascript so I don't know how to do that. And I'm not sure what you mean by breaking up the script, I put some blank lines between the two strands of links. I'm not sure if that was enough or not. I also got rid of some unnecessary codes.

SpiritualStorms
06-28-2004, 09:02 AM
i often read posts, and some are just crappy in how they go about in trying to get an answer to a question. Some seem to just paste the whole page, which is unnecessary.

So when i say it break down, i mean, paste the actual structure of your function, and not all of your functions, and then, paste the code that relates to the calling of a function, such as an event-handler, and not the whole document.

Web-design generally comes in pieces that are inner connected somehow. This is how i look at it. I know the HTML is one part, the programming is another, and the connection between the 2 is the 3rd part. This is what i mean then about breaking your code down into their most basic parts, such as function definition, and function call. One is not necessarily the other.

misscali
06-28-2004, 07:44 PM
ok I'll try. I have to say that I'm new to javascript and Im not really familiar with all this stuff. I'm more of an html person. Well here's the script that I felt was vital:

<script language="JavaScript" type="text/javascript">
<!--
function init(){
flame=document.getElementById('flame');
flame.style.left='0px';
w=document.getElementById('linkContainer').offsetWidth+document.getElementById('img').offsetWidth;
setTimeout('moveFlameR()',wait);
}
function moveFlameR(){
l=parseInt(flame.style.left)
if(l<w+speed){
flame.style.left=l+speed+'px';
timer=setTimeout('moveFlameR()',speed2);
}
if(l>=w+speed){
clearTimeout(timer);
setTimeout('moveFlameL()',wait);
}
}
function moveFlameL(){
l=parseInt(flame.style.left)
flame.style.left=l-speed+'px';
timer=setTimeout('moveFlameL()',speed2);
if(l==0){
clearTimeout(timer);
setTimeout('moveFlameR()',wait);
}
}
//-->
</script></head>

<body onload="init();">
<div id="container">
<span id="flame" class="flame"><img src="image.gif" class="flame" id="img"></span>
<div class="linkContainer" id="linkContainer">
<span class="link"><A href="http://google.com">google</A></span>

<!-- several more links were here --></div></div>

<div id="container">
<span id="flame" class="flame"><img src="image.gif" border=0 class="flame" id="img"></span>
<div class="linkContainer" id="linkContainer">
<span class="link"><A href="http://excite.com">excite</A></span>
<!-- several more links --></div></div>


Tell me if I left anything out. I wasn't sure if you needed the part that identified the link container etc.

Willy Duitt
06-28-2004, 08:28 PM
If it was me, I would place each row of links in their own division and when moveFlameR reached the availWidth, I would fire moveFlameL which targets the second row divison. And repeat....

The changes could probably be made in a few minutes. If you wrote the original code I will help you modify those. However, if, as I believe, someone else wrote those codes, I would not be comfortable modifying the codes with their credits removed....

.....Willy

misscali
06-29-2004, 12:06 AM
lol yeah, someone else wrote them, and I hate to tell you but I have no idea how to do that. I thought I did have them in seperate divisions though.

SpiritualStorms
06-29-2004, 07:31 AM
No offense, but if you didnt write them, and you are not that familiar with it, why do you not start asking questions at a much lower level? In other words, what do you want to know? Are you looking to learn JavaScript, or do you simply want for someone to do your programming?

misscali
06-30-2004, 03:06 AM
well I did some of it. I just wanted to improve it a little. I have no intention of denying people credit. The script is kind of useless for me if I don't fix it. I dont really see another option than asking for help; I didn't think that was so bad...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum