Animated Menu Using jQuery Animate Function

You would have seen many websites having attractive menu bars, when you mouse hover menu items then they display details. It looks really good as well as user friendly as user will get to know more as he enters that menu area. Most of these menu bars are animated and designed using flash. But using flash in websites has some disadvantages like it requires flash plugin to be installed in browser etc.

animated menu jquery infotuts


In this tutorial we will achieve something similar using jQuery animation.  Lets learn about jQuery custom animation:

The syntax of Jquery’s animate function is:


The key parameter is params. It defines the properties that will be animated. Many properties can be defined/animated at the same time: for example


The second parameter is speed. It defines the flow/speed with which animation would occur. It takes the values “fast”, “slow”, “normal”, or milliseconds.

The third parameter easing takes two values “swing” and “linear”. Swing makes animation slower at the start and it becomes faster in the middle. Linear animation makes it to move in a constant speed.

Fourth parameter is callback. It means you can call a function here which will be executed after the animation is completed.

Lets understand how to create animated menu bar using jQuery animation. Below is our jQuery code:

<title>Animated Menu Using jQuery</title>

<script type="text/javascript" src="jquery.js"></script><script type="text/javascript">

$(".menu a").append("<p></p>"); // append <p> tag to anchor of menu class.

$(".menu a").hover(function() {
$(this).find("p").animate({opacity: "show", top: "-75", fontSize:"1em"}, "slow");
// function to show animation effect on hover
var hoverDisplayText = $(this).attr("title"); // set value of title attribute in a variable
}, function() {
$(this).find("p").animate({opacity: "hide", top: "-100"}, "fast");
// function to hide animation effect after hover
<a href="" title="Go to homepage">Home</a>
<a href="" title="jQuery custom animation">Tutorial link</a>
<a href="" title="Like Us on Facebook">Facebook</a>

<a href="" title="Join Me On Google+">Google +</a>

Thanks to WebDesignerWall for wonderful implementation.

You can give any other custom animation using jQuery.  Play with the jQuery code and you will see how amazing it is.

About sanjeev

Dreamer, Blogger and Thinker. I love to help people in solving their problems. You can also join me HERE

Related posts:

5 Responses so far.

  1. Thank you for the great tutorial. I found this typo error.
    In source code css, .menu li p{ background url image must be hover1.png.

    I come to learn your tutorial by the recommendation of

      1. HI genk,

        Please Check Live DEMO of the tutorial and have a look at the source code or download the source file. you will see the css.


Comments are closed.