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 3218022
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:28:45+00:00 2026-05-17T15:28:45+00:00

I want to create two functions what fades in and out an element. This

  • 0

I want to create two functions what fades in and out an element.

This is what I have done so far, but the problem with this is that if you move the mouse while you are in the hovered element it starts vibrating 😐 How should I make it to not vibrate and work correctly?

<script language="javascript" type="text/javascript">
 function hoverIn(target, speed){
     $(target).fadeIn(speed); 
 }

 function hoverOut(target, speed){
     $(target).fadeOut(speed); 
 }
</script>

LIVE PREVIEW – check out the problem in live

  • 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-17T15:28:46+00:00Added an answer on May 17, 2026 at 3:28 pm

    A better way to do this would be using unobtrusive script, the main thing you want is a .stop() call to stop the previous animation, like this:

    <script type="text/javascript">
     function hoverIn(target, speed){
         $(target).stop(true, true).fadeIn(speed); 
     }
    
     function hoverOut(target, speed){
         $(target).stop(true, true).fadeOut(speed); 
     }
    </script>
    

    This is still a problem because mouseover and mouseout fire when entering/leaving a child. However, .hover() uses mouseenter and mouseleave which don’t suffer the same problem, and will eliminate your “vibration” problem.

    The unobtrusive version looks like this:

    $(function() {
      $("ul > li").hover(function() {
        $(this).find("ul").stop(true, true).fadeIn('fast');
      }, function() {
        $(this).find("ul").stop(true, true).fadeOut('fast');
      });
    });​
    

    You can see it here, or the even shorter version:

    $(function() {
      $("ul > li").hover(function() {
        $(this).find("ul").stop(true, true).animate({opacity: 'toggle'}, 'fast');
      });
    });​
    

    You can test that here, note that all of these unobtrusive approaches don’t use any inline javascript, and work for multiple child menus.

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

Sidebar

Related Questions

I have two functions that I want to run on different threads (because they're
I want to create two functions, say long min(long...); int min(int...); But when I
I have two a tags and I want to create two separate click functions
I want to create two widgets in flex. One for the movies ( that
I have a state column in a dataframe and I want to create two
I want to create a new field (or two) in my table that is
I want to create a view that contains two forms with their submit buttons.
I created a website but i have a problem. i want to build once
I have this two functions: procedure TDisplay.CubAssign(VAR Obj: TCubObj; CONST bReleaseOnExit: boolean); begin ReleaseCubOnExit:=
I want to create two thumbnails withh different sizes with two functions. uploadImage() makes

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.