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

  • SEARCH
  • Home
  • 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 3400826
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:56:25+00:00 2026-05-18T04:56:25+00:00

I would like to bump a menu item out 5px on mouseover and have

  • 0

I would like to bump a menu item out 5px on mouseover and have it return to its original position using Scriptaculous. I am using the afterFinish callback to ensure that the bump-out Move effect is completed before the bump-back-in Move effect runs.

The problem is that the item doesn’t return to its original position if you quickly mouseover and mouseout more than once. The more you mouseover-and-out, the more it’s off. I thought this is what the afterFinish callback was supposed to prevent. It seems to work correctly with the Morph effect, and it’s supposed to work with all Scriptaculous effects, as stated below:

Javascript – Scriptaculous – Effect Callback function

I’ve tried using effects queues, same result, and spent several hours scouring various forums to help me understand this.

Here is the Morph example that works correctly:

<SCRIPT>
function morphMe(obj) {
  new Effect.Morph($(obj), {
  style: {
  height: '200px',
  width: '200px'},
  afterFinish: function(){ new Effect.Morph($(obj), {
    style: {
    height: '20px',
    width: '200px'}}); 
    }
  })
}
</SCRIPT>
<div id="bumptest" class="leftnav" style="position: absolute; left: 100px; width: 200px; border: 1px solid green" onmouseover="morphme(this);">Morph Me</div>

Here’s the Move example that doesn’t work as expected on quick mouseover and outs. Perhaps I need use setTimeout but I don’t understand why this should be necessary.

<SCRIPT>
function OnFinish(obj){
 new Effect.Move(obj.element.id, {x: -5, y: 0, duration: .4});
}

function bumpOut(myObject){
 new Effect.Move(myObject, 
  { x: 5,
    y: 0,
    duration: 0.4,
    afterFinish: OnFinish,
  });
}
</SCRIPT>
<div id="bumptest" class="leftnav" style="position: absolute; left: 100px; width: 200px; border: 1px solid green" onmouseover="bumpOut(this);">Bump me right and then back</div>

Any help, maybe even a mod using setTimeout or a pointer to a solid script that already does this, greatly appreciated.

Thanks,

motorhobo

  • 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-05-18T04:56:26+00:00Added an answer on May 18, 2026 at 4:56 am

    You’ll need to think parallel: the problem occurs when several effects are running at the same time. Actually, it’s because of the way that scriptacoulous handles effects: it calculates the target position at creation time of the effect.

    The following scenario doesn’t take afterFinish into account:

    • 0.0s: 1st new Effect: “My current position is (100|10), I need to move 6px right, so my target position is (106|10) in 0.4 seconds.”
    • 0.2s: 2nd new Effect: “My current position is (103|10), I need to move 6px right, so my target position is (109|10).” <- Oops, offset!
    • 0.2 – 0.4s: both effects will change the left value (may cause some flickering)
    • 0.4 – 0.6s: Only the second effect is left, moves from (106|10) to (109|10).
    • 0.6s: Div is at (109|10).

    (The same reasoning applies to highlight(): If you highlight several times at once, the background color doesn’t revert to the original one. Also applies to: Scale, BlindDown/Up, and some others.)

    The solution to this is to give absolute values at every call:

    $(this).morph({left:106px}); // etc.
    

    Queues are another part of the solution. When bumpOut is called, make sure that any OnFinish-Effect is cancelled – otherwise the position of the box will flicker. More validity checks may be necessary to make sure that:

    • Only one bump-effect is executed on this box at a time
    • This is the right one (“recent activity cancels out more older ones” or “an animation that has started has to finish first.”).

    A third roadblock: mouseover is triggered also when a child element of bumptest (even a <b>!) is hovered, so much more often than you’d normally expect. Use mouseenter / mouseleave if you want to get the event of entering / leaving bumptest only once.

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

Sidebar

Related Questions

Would like to see if someone can help me on figuring out how to
I have a List of strings (GUIDS) and I would like to take one
I bump into something like this quite often. This time I have sprite sheet
I would like to know how to bump the last digit in a version
I would like to add a bump feature in my app in android but
would like to have a central place to register new signals, connect to signals,
Would like to get the contacts created using the contacts app in the emulator
Would like to use the return of: http://maps.google.de/maps/suggest?q=ham&cp=1&hl=de&gl=de&v=2&json=b as a JSON object in a
Would like to know is that possible to have filter with default value with
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode

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.