Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question link menu script

    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.

  • #2
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Do you have the script?

    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.
    LovesWar

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts

    i mean simply to compartmentalise your whole code.

    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.
    LovesWar

  • #5
    New Coder
    Join Date
    Jun 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #7
    New Coder
    Join Date
    Jun 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts

    to misscali........

    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?
    LovesWar

  • #9
    New Coder
    Join Date
    Jun 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •