Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:20:31+00:00 2026-06-17T19:20:31+00:00

I couldn’t seem to find an answer to this question so I thought I

  • 0

I couldn’t seem to find an answer to this question so I thought I would ask. I am writing my first website, and I am using a little bit of Javascript to slide each individual navigation element up when the mouse hovers over it. Then on mouseout it slides back down.

It is working fine except when the mouse goes from an “up” element to a “down” one before the “up” has time to slide back down, it gets messed up and stays up while the “down” elements thinks it should slide down. I think that the new mouseover event is getting mixed up with the previous one, but I’m not sure how to fix it.

I hope that explains my problem, here is the code I am working with (The CSS is pretty straight forward position is relative for each navigation tab so I didn’t show it):

Javascript:

var cartridges, obj, lastObj;
var velocity = 2;

function setUp() {
    if (!document.getElementById) return;
        cartridges = document.getElementsByClassName('navigation');
    for (var i = 0; i < cartridges.length; i++) {
        cartridges[i].onmouseover = slideUp;
        cartridges[i].onmouseout = slideDown;
   }
}

function slideUp(e) {
    if (!e) var e = window.event;
    obj = (e.target) ? e.target: e.srcElement;
    var up = obj.style.top;
    up = up.substring(0, up.length - 2);
    parseInt(up);

    function frame() { 
        up -= velocity; // update parameters     
        obj.style.top = up + "px"; // show frame
        if (up <= -100)  // check finish condition (negative because that pushes it up, otherwise it would go down
            clearInterval(id);
    }
    var id = setInterval(frame, 10); // draw every 10ms 
}

function slideDown() {
    var up = obj.style.top;
    up = up.substring(0, up.length - 2);
    parseInt(up);

    function frame() { 
        up++;  // update parameters 
        obj.style.top = up + "px";
        if (up >= 0)  // check finish condition (negative because that pushes it up, otherwise it would go down
            clearInterval(id);
    }
    var id = setInterval(frame, 10); // draw every 10ms 
}

window.onload = setUp;  

HTML:

<div id="navigation">
            <ul>
                <li><a  class="navigation" href="index.html" ><img id="home" alt="Home" src="../images/cartridge_grey_index.png" /></a></li>
                <li><a  class="navigation" href="aboutme.html"><img id="aboutme" alt="About Me" src="../images/cartridge_grey_aboutme.png" /></a></li>
                <li><a  class="navigation" href="resume.html"><img id="resume" alt="resume" src="../images/cartridge_grey_resume.png" /></a></li>
                <li><a  class="navigation" href="projects.html"><img id="projects" alt="projects" src="../images/cartridge_grey_projects.png" /></a></li>
                <li><a  class="navigation" href="blog.html"><img id="blog" alt="blog" src="../images/cartridge_grey_blog.png" /></a></li>
                <li><a  class="navigation" href="contact.html"><img id="contact" alt="contact" src="../images/cartridge_grey_contact.png" /></a></li>
            </ul>
        </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:20:33+00:00Added an answer on June 17, 2026 at 7:20 pm

    If you are new to the web, and especially new to the world of Javascript, I would highly recommend using a library such as jQuery or MooTools to accomplish a sliding menu. There are many plugins already available, or if you want to go through the learning process, you can wire it up yourself pretty easily.

    jQuery provides convenient methods such as .mouseover() and .slideUp(), which makes this task nearly trivial, or you can choose from a listing of other effects such as fade and show/hide. As an added bonus, you’ll get compatibility across all browsers as well.

    For more info, check out: http://api.jquery.com

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Couldn't seem to find the answer to this question - what is the haml
I couldn't find this question asked, so I gotta ask: how closely does Android
Couldn't find an answer to this question. It must be obvious, but still. I
I couldn't find the answer to this question in SO. I'll try to explain.
I couldn't seem to find a similar question to this. I am currently looking
I couldn't find a straight answer to my question and need to know it
Couldn't find a better place to ask this so I hope you guys can
I couldn't find a definitive answer from the PayPal docs on this. According to
Couldn't find an answer to this anywhere, but essentially I am wanting to add
Couldn't seem to get any bites on this over at AskDifferent so thought I'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.