Suggest a Snippet Login Register
  • LOG IN:

    Not a member? JOIN NOW!
     Username                   Password
    Remember me Recover password
DevSnippets Design Community & Snippets Gallery
  • Subscribe by RSS
>
  • Webdesign
    • Design
    • HTML5
    • lists
    • Menu
    • Navigation
    • Portfolio
    • Showcase
    • Template
    • Tooltip
    • Tutorial
    • webdesign
  • Web development
    • AJAX
    • CodeIgniter
    • CSS
    • CSS3
    • Database
    • Javascript
    • jQuery
    • Mootools
    • MySQL
    • PHP
    • PHP Framework
    • plugins
    • WordPress
    • WordPress Hacks
  • Inspiration
    • Fonts
    • Icons
    • Inspiration
    • Mac
    • Mac apps
    • Photography
    • Wallpapers
  • Snippets
In {Articles} -14th Apr- {35 Comments}

Slick Drop down Menu with Easing Effect Using jQuery & CSS

Drop-down menus are an excellent feature because they help clean up a busy layout. When structured correctly, drop-down menus can be a great navigation tool, while still being an attractive design feature.

Continuing from “DAY2: Fading Background Color With jQuery .animate()“, today we would like to take a look at another effect that we can create using the .animate() function.

In this tutorial we’re going to be using the jQuery & CSS to create an attractive and functional dropdown menu. We’ll have a multilevel <ul>, which has a series of <li> elements each containing different blocks of <ul>. We are going to use jQuery to display the submenu items in and out of view.

Make sure to subscribe to our RSS Feed and follow us on Twitter to get updates on our new post series: jQuery .animate() function and what you can do with it.

Let’s have a sneak peak about what we are going to create today.

Check out the demo of “Slick Drop down Menu with Easing Effect With jQuery & CSS”.

Slick Drop down Menu with Easing Effect With jQuery & CSS

Creating a Slick Drop down Menu with Easing Effect

Step1. HTML

Slick Drop down Menu with Easing Effect With jQuery & CSS
First create an unordered list for your main top navigation. Then simply nest another unordered list for your sub navigation.

<ul class="blockeasing">
     <li class="main"><a href="#">About Us</a>
         <ul class="subnav">
            <li><a href="#">Overview</a></li>
            <li><a href="#">Products</a></li>
            <li><a href="#">Services</a></li>
            <li><a href="#">Why Us</a></li>
        </ul>
     </li>
     <li class="main"><a href="#">Products</a>
         <ul class="subnav">
            <li><a href="#">Main Product</a></li>
            <li><a href="#">DSL Lines</a></li>
            <li><a href="#">DialUps</a></li>
            <li><a href="#">Main Stream</a></li>
        </ul>
     </li>
     <li class="main"><a href="#">Contact Us</a>
         <ul class="subnav">
            <li><a href="#">Twitter</a></li>
            <li><a href="#">Email</a></li>
            <li><a href="#">LinkedIn</a></li>
            <li><a href="#">Facebook</a></li>
        </ul>
     </li>
</ul>

Step2. CSS

Now that the menu structure is in place we’ll add some styles to hide the sub navigation. Display must be set to none to the <ul> that carries the sub navigation items. This will ensure that the submenu is kept hidden when the mouse is not hovered on the block carrying the submenu.

ul.blockeasing {
      color:#CCCCCC;
      float:left;
      font-size:11px;
      padding:0;
      width:560px;
}
ul.blockeasing li{
      background:none repeat scroll 0 0 #333333;
      border:2px solid #000000;
      display:block;
      float:left;
      height:15px;
      list-style:none outside none;
      margin:0 5px;
      padding:5px 0px;
      text-align:center;
      text-shadow:0 1px 1px #000000;
      text-transform:uppercase;
      width:130px;
      position:relative;
}

ul.blockeasing li a{
     color:#CCCCCC;
}

ul.blockeasing li ul{
     background:none repeat scroll 0 0 #333;
     border-bottom:3px solid #DE93C3;
     float:left;
     padding:20px 5px 0;
     display: none;
     position:absolute;
     left:-50%;
     width:250px;
     margin-top:15px
     }

ul.blockeasing li ul li{
    border:none;
    border-bottom:1px solid #ccc;
    padding:5px;
    float:left;
    width:100px;
    overflow:hidden
    }

Step3. jQuery

The following script contains comments explaining which jQuery actions are being performed.

 $(document).ready(function() {
        $("ul.blockeasing li.main").mouseover(function(){ //When mouse over ...
        	   //Following event is applied to the subnav itself (making height of subnav 60px)
		      $(this).find('.subnav').stop().animate({height: '60px', opacity:'1'},{queue:false, duration:1500, easing: 'easeOutBounce'})
		});

	    $("ul.blockeasing li.main").mouseout(function(){ //When mouse out ...
	          //Following event is applied to the subnav itself (making height of subnav 0px)
		      $(this).find('.subnav').stop().animate({height:'0px', opacity:'0'},{queue:false, duration:1600, easing: 'easeOutBounce'})
		});
        //menu item background color animation
		$("li").hover(function() {
              $(this).stop().animate({ backgroundColor: "#C13D93"}, 600);},
           function() {
              $(this).stop().animate({ backgroundColor: "#333333" }, 600);
        });
});

Using the .stop() method before the animate() fixes the animation queue buildup where the animation will loop repeatedly by moving your mouse back and forth over the item.

Conclusion

The menu is a great addition to any interface; it’s easy for us to set up and easy for our visitors to use, it’s tactile and interactive and can be used in a variety of situations.

If you have suggestions or comments, feel free to let me know about it; I am still learning.

Check out the demo of “Slick Drop down Menu with Easing Effect With jQuery & CSS”.

Download Zip File.

To Be Continued on DAY 4…

Author: Noura Yehia

Noura Yehia is a Web Designer, Blogger and Creative Thinker. Founder of Noupe.com a popular blog about web design, tutorials, resources and inspiration. If you’d like to connect with her, you can follow her on Twitter or at her blog Devsnippets.

Category: Article | Leave a Comment | 35 Comments

Related Posts

  • Getting Slim, Spicy, & WordPress-Ready with Top 10 jQuery Plugins Getting Slim, Spicy, & WordPress-Ready with Top 10 jQuery Plugins
  • Creating Slick Forms Using Ajax, jQuery & CSS: No More Ugly Forms Creating Slick Forms Using Ajax, jQuery & CSS: No More Ugly Forms
  • Using jQuery The Sexy Way: 7 Great Techniques For a Slick Layout Using jQuery The Sexy Way: 7 Great Techniques For a Slick Layout
  • DAY 2: Fading Background Color With jQuery .animate() DAY 2: Fading Background Color With jQuery .animate()

35 Comments, Add Comment or Ping

  1. Beben says:
    April 14, 2010 at 8:51 am

    so smooth…cool

  2. Alex Fueras says:
    April 14, 2010 at 11:21 am

    Really nice plugin. Thanks for sharing.

  3. wespai says:
    April 14, 2010 at 7:13 pm

    nice plugin

  4. Rose says:
    April 15, 2010 at 12:20 am

    Love the post Noura, keep it up.

    All the best.

  5. mil says:
    April 15, 2010 at 1:46 am

    Nice plugin but it doesn’t work at IE :(

  6. sushilshirbhate says:
    April 16, 2010 at 12:46 am

    Really nice plugin. Thanks for sharing.

  7. Jordan Walker says:
    April 16, 2010 at 7:25 am

    Beautiful and refreshing plug-in and contribution to the community. Thanks you very much.

  8. beninsky says:
    May 10, 2010 at 6:37 pm

    OK I discovered a bug that can happen RARELY but it is still annoying :(

    I made a video to show you: http://www.youtube.com/watch?v=Biv0GUR-C0w

    When I load the page for the first time and use the menu, if I leave my mouse cursor just on top of menu, then the menu close and immediatly after reopen…

    I removed the opacity option to show you the bug, opacity can be a solution, but I how can I do if I don’t want to add an opacity effet :S

    I FOUND THE SOLUTION: Add “overflow:hidden” into UL CSS Styles

    Here is the code:

    ul.blockeasing li ul.subnav{
    background:none repeat scroll 0 0 #333;
    border-bottom:2px solid #c13d93;
    float:left;
    padding:0px 5px 0;
    position:absolute;
    left:-50%;
    width:250px;
    margin-top:15px;
    height:0px;
    display:none;
    overflow:hidden;
    }

Trackbacks/Pingbacks

  • designfloat.com
  • Slick Drop down Menu with Easing Effect Using jQuery & CSS | Tutorialicious.info
  • Slick Drop down Menu with Easing Effect Using jQuery & CSS | DevSnippets « Netcrema – creme de la social news via digg + delicious + stumpleupon + reddit
  • Slick Drop down Menu with Easing Effect Using jQuery & CSS | DevSnippets » Web Design
  • Slick Drop down Menu with Easing Effect Using jQuery & CSS | pro2go Designs Blog
  • Napilink április 15 | hdesign
  • Napi okosságok – 2010/04/15 | Yloz féle zacc
  • woobill.com
  • Link Bytes 4.16.10 « SRSLYLIZ.COM
  • [jQuery] Creare un bellissimo menu a discesa con effetto easing! | sastgroup.com
  • Slick Drop down Menu with Easing Effect Using jQuery & CSS « RMDsite | Rich Media and Development Site Links and Resources
  • Slick Drop down Menu with Easing Effect Using jQuery & CSS
  • Weekly Good Tweets – 04.12 – 04.17 « Tutvid News
  • This Weeks Twitter Design News Roundup N.33 - Speckyboy Design Magazine
  • This Weeks Twitter Design News Roundup N.33 - Programming Blog
  • This Weeks Twitter Design News Roundup N.33 · rogdykker
  • This Weeks Twitter Design News Roundup N.33 | Forum on China Wholesale Lots
  • This Weeks Twitter Design News Roundup N.33 | DesignerLinks | Home to Web design news, jQuery Tutorials, CSS tutorials, Web Designing tutorials, JavaScript tutorials and more!
  • [jquery] creare un bellissimo menu a discesa con effetto easing!
  • freewebdev.jp
  • Drop down menu con le slick allentamento effetto utilizzando jQuery & CSS
  • This Weeks Twitter Design News Roundup N.33 « PsTrick
  • Weekly Design News – Resources, Tutorials and Freebies (N.34) - Speckyboy Design Magazine
  • Weekly Design News – Resources, Tutorials and Freebies (N.34) | DesignerLinks | Home to Web design news, jQuery Tutorials, CSS tutorials, Web Designing tutorials, JavaScript tutorials and more!
  • Weekly Design News – Resources, Tutorials and Freebies (N.34) « Film and entertainment
  • Weekly Design News – Resources, Tutorials and Freebies (N.34) | Forum on China Wholesale Lots
  • Weekly Design News – Resources, Tutorials and Freebies (N.34) | Master

Sponsored Ads

ADVERTISE HERE

Sponsored Ads

DevSnippets Latest Articles

  • Using Illustrations in WebDesign: 30 Creative Examples
    Tags: Illustration, Inspiration, webdesign Jul/20/2010
  • Dark and Mysterious High Quality Desktop Wallpapers
    Tags: Dark, Wallpapers Jun/23/2010
  • 10+ Most Beautiful Island Photography on Earth
    Jun/16/2010
  • 35 High Definition iPad Wallpapers For A Great Experience
    Tags: Inpiration, Wallpapers Jun/09/2010
  • 30 Unique Logo Designs That Actually Say Something
    Tags: Branding, Inspiration, Logo Jun/02/2010
  • Creating 10 Most-Used Javascript Techniques Using Pure CSS Styling
    Tags: CSS, Tutorial May/31/2010
  • 40 Creative Advertisements With Unexpected Ideas
    Tags: Advertising, Inspiration May/27/2010
  • Getting Slim, Spicy, & WordPress-Ready with Top 10 jQuery Plugins
    Tags: jQuery, WordPress May/25/2010
  • Spicing Up Your Tumblr Experience: Beautiful Themes, Icons and Apps
    Tags: Templates, Tumblr May/19/2010
  • 20 NEW & FREE High Quality (X)HTML/CSS Templates
    Tags: CSS, Design, Template, Tutorial May/17/2010
More Articles →

Design Community News

  • Is It Worth Shifting To Photoshop CS5?

    SloDive
    Jul/04/2010
  • Free Wordpress Theme Vector Nature Template

    templates4all
    Jul/04/2010
  • Best jQuery plugins – June 2010

    Spider8411
    Jun/22/2010
  • Freebies: Vintage Mega Pack 10 Samples from Designious.com

    Doink
    Jun/22/2010
  • CSS3 Animations, the Power Back to CSS Part 1: Transitions

    Teylor Feliz
    Jun/22/2010
  • Create a Photo-Realistic Candle with Basic Photoshop Tools

    Frank
    Jun/22/2010
  • Credit cards and payment icon set

    icon sets
    Jun/22/2010
  • 40 Refreshing Nature Inspired Web Designs

    Brukhar
    Jun/22/2010
  • How to Create a Tumblr Theme (Code Structure)

    Dainis Graveris
    Jun/21/2010
  • The Simple Photoshop CS5 Cheat Sheet

    Frank
    Jun/21/2010
More News →

Our Friends

  • Graphic Design School

  • Designm.ag

Top ↑

Add a Snippet / Design News

© 2008-2010 DEVSNIPPETS | Made by Noura Yehia | Submit Snippet | About| Subscribe | Advertise
In partnership with (mt) Media Temple