Everything Photoshop Subscribe

Create a Cool Animated Navigation with CSS and jQuery

In Javascript / AJAX by Joash Xu

Animation and visual feedback are great ways to assist a user in navigating and interacting with a website. While traditionally Adobe's Flash was the goto for anything animated, these days with the magic of javascript we can avoid Flash altogether. Today we're going to build a really cool animated navigation menu using just CSS and jQuery.

Demo and Source Code

Overview

The menu we're building can be seen in the screenshot below. You can also see the final working version here.

I'm going to break this tutorial up into five sections as follows:

  • Rough sketch
  • Creating Resources
  • Writing down the HTML
  • Writing down the CSS
  • Creating the animation using jQuery

Step 1 : Rough Sketch

First of all let us see what we need to do here.

So here's a rough idea of what we should do:

  • We will split the page into 4 parts, header, navigation and content header and the rest of content
  • The header area will be simple <div> container
  • The navigation area will be split into several <div> container matching the menu item.
  • Now most of the time we use <ul><li> container but since every menu item is unique, I do not see the advantages of using <ul><li> so I am going to use <div> container instead.
  • The content will be a simple <div> container
So to summarize it
<!-- header section-->
<div id="header"></div>

<!-- navigation section-->		
<div id="navigation" class="container">
	<div><a href="#">home</a></div>
	<div><a href="#">about</a></div>
	<div><a href="#">services</a></div>
	<div><a href="#">solutions</a></div>
	<div><a href="#">contact</a></div>
</div>

<!-- container section-->
<div class="container">
	<div id="content-title"></div>
	
</div>

It might help to show the directory structure I'm. The directory structure is as follows:

Step 2: Resources

I assume you have basic knowledge in dealing with Photoshop, so I will not give too detail instruction on creating the resources. There are several things we need to create.

  • Header background
  • Content Title
  • Navigation
  • Background stripe

Note that if you wish to skip this step you can download the full zip of files at the end of the tutorial and extract my copies!

Okay, let's create the header background. Open up Photoshop and create a 1x181 px canvas, or you can create it larger and then crop the image. Create a layer and give it a linear gradient with Foreground to Background preset for 171px, this will be the main gradient. Create another layer and give it a linear gradient with Foreground to Transparent preset for about 10px at the bottom of the first layer for some shadow effect.

Here is what it should look like, it is 100x181 px that I later crop to 1x181 px.

Save this as 'hdr-bkg.png' in our 'img' folder.

Next, we will create the content title. Again, open up Photoshop and create 934x284 px. Create Rounded Rectangle using the appropriate tool, select the created shape, create a new layer, add a gradient and give it some drop shadow. Then we will have something like this:

Save this as 'content-title.png' in 'img' folder.

Now let us create the resources needed by the navigation. We need two sets of navigation and a white box.

The white box is simple. Just create a rounded rectangle of about 98px x 58px and paint it with white. Ensure the background is transparent.

Save this as 'white.jpg' in 'img' folder.

For the navigation item, open your Photoshop and create a 490px x 58px document. Create a rounded rectangular with about 98px x 58px and put some text in it. We will need two copy of each text. I applied a little drop shadow on each text, this of course is optional. You can choose your own colors to put here.

Now simply duplicate this layer along the horizontal line. Apply different colors and text.

Save this as 'nav.jpg' in 'img' folder.

Finally, for the background stripe I have simply used an online tool called the Stripe Generator. The output looks like this:

You can see my settings here. Of course you could just create the stripe yourself in Photoshop, but why not use a neat little web tool instead :-)

Step 3: HTML code

Now let’s jot down our HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>slick animated menu</title>
  	<!--our CSS file-->
	<link rel="stylesheet" href="css/main.css" type="text/css" />
	<!--jQuery library-->
	<script type="text/javascript" src="js/jquery.js" ></script>
	<!--jQuery plugin, we’ll get to this later-->
	<script type="text/javascript" src="js/jquery-bp.js" ></script>
	<!--Our animation script-->
	<script type="text/javascript" src="js/navigation.js" ></script>
</head>
<body>
	<div id="header"></div>
	<div id="navigation" class="container">
		<div id="home"><a href="home">home</a></div>
		<div id="about"><a href="about">about</a></div>
		<div id="services"><a href="services">services</a></div>
		<div id="solutions"><a href="solutions">solutions</a></div>
		<div id="contact"><a href="contact">contact</a></div>
	</div>
	<div class="container">
		<div class="content">
			<div id="content-title"></div>
			
		</div>
	</div>
</body>

This is prety much according to our gameplan explained on Step 1.

I have added a link to a 'main.css' file that is yet to be created and I have also added some references to some javascript files. Since every navigation item is unique I have given each item an ID. We will still need some common style to each of the menu items, this will make it easy for us to manage the style in later stages.

We will also have a white box on top of every navigation item appear, when we hover over the menu or a menu item is being selected, so we will need another <div> container for that. The final HTML will look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>slick animated menu</title>
  
	<link rel="stylesheet" href="css/main.css" type="text/css" />
	
	<script type="text/javascript" src="js/jquery.js" ></script>
	<script type="text/javascript" src="js/jquery-bp.js" ></script>
	<script type="text/javascript" src="js/navigation.js" ></script>
</head>
<body>
	<div id="header"></div>
	<div id="navigation" class="container">
		<div id="home" class="pri-nav"><div><a href="home">home</a></div></div>
		<div id="about" class="pri-nav"><div><a href="about">about</a></div></div>
		<div id="services" class="pri-nav"><div><a href="services">services</a></div></div>
		<div id="solutions" class="pri-nav"><div><a href="solutions">solutions</a></div></div>
		<div id="contact" class="pri-nav"><div><a href="contact">contact</a></div></div>
	</div>
	<div class="container">
		<div class="content">
			<div id="content-title"></div>
			
		</div>
	</div>
</body>
Save this as 'index.html'. Up to this point we have this as our HTML page:

Step 4: CSS

Let us apply some basic style to the Web page. We will start by defining the background and adding a header area.
body {
	background: url(../img/body-bkg.jpg) repeat scroll;
	margin: 0;
	padding: 0;
}

.containe r{
	margin: 0pt auto;
	width:950px;
}
#header {
	background: url(../img/hdr-bkg.jpg) repeat-x scroll;
	height:181px;
}
Save this as ‘main.css’ in 'css' folder. Now we have something that looks like:

Now let’s add style to each of the menu items. Remember we want the white box at the top each of menu item, so the position must be set to absolute. Append the following style in our 'main.css' file.

#navigation{
	height:60px;
}

#home, #home div, 
#about, #about div, 
#services , #services div, 
#solutions, #solutions div, 
#contact,  #contact div {
	height:80px;
	position:absolute;
	width:97px;
	float:left;
}

#home, #about, #services, #solutions, #contact{
	background-image: url(../img/nav.jpg);
	background-attachment: scroll;
	background-repeat: no-repeat;
	top:171px;
}

#home{
	background-position: 0px -25px;
	margin-left:6px;
}

#about{
	background-position: -98px -25px;
	margin-left:105px;
}

#services{
	background-position: -196px -25px;
	margin-left:204px;
}

#solutions{
	background-position: -294px -25px;
	margin-left:303px;
}

#contact{
	background-position: -392px -25px;
	margin-left:402px;
}

#home div, #about div, #services div, #solutions div, #contact div {
	background-image: url(../img/white.jpg);
	background-attachment: scroll;
	background-repeat: no-repeat;
	background-position: 0px -60px;	
}	
Now we have :

One problem, the <a href> link appears on top of the menu items, let’s remove that with a huge text indent - effectively taking it off the screen. Add this to our style sheet.

.pri-nav a{
	display:block;
	text-decoration:none;
	text-indent:-30000px; 
}
Now it will look like this:
We've still got one problem, we would like the navigation menu to appear below the header shadow. We can achieve that by modifying our header style.
#header{
	background: url(../img/hdr-bkg.jpg) repeat-x scroll;
	height:181px;
	position:absolute;
	z-index :100; /* ensure the header is on top of navigation area */
	top: 0px;
	left:0px;
	width:100%;
}
Now because we used a .png file with transparency, it should look like this:
Perfect! Let’s add the content so we can get to our animation script.
.content{
	margin-top:160px;
}

#content-title{
	background: url(../img/content.jpg) no-repeat scroll;
	height:323px;
	position:absolute;
	width:100%;
}

Step 5: Animation script

First let's download the latest jQuery script and place it in the 'js' folder.

The animation is basically a background position style manipulation. Unfortunately jQuery has bug in animating background position style. But worry not! Alexander Farkas has created a plugin that solves this problem. Download the file and rename it to jquery-bp.js and store it in the 'js' folder.

There is something we need to understand before proceeding. I quote from the plugin documentation:

Due to some browser bugs (i.e. Firefox, you have to set your (initial) background-position inline: <div style="background-position: 10px 20px"></div> - Of course you can achieve this with JavaScript (jQuery), too: $('#background').css({backgroundPosition: '10px 20px'});

Okay now that we understand that, let’s start. We will set the backgroud position style for every item in the beginning of our script.
// id for each of our menu items
var nav  = [ '#home', '#about', '#services', '#solutions', '#contact' ];
$(document).ready(function(){
  setBkgPos();
});

function setBkgPos()
{
  for ( i = 0; i < nav.length; i++ ){
    $(nav[i]).css({backgroundPosition: i*(-98) + 'px -25px'});
    $(nav[i] + ' div').css({ backgroundPosition: '0px -60px'});
  }
}
Save this as 'navigation.js' in 'js' folder.

Now we will bind 3 events to each of the menu items. We can do this by invoking the bind function.

$(document).ready(function(){
  setBkgPos();

  // bind the event to function here
  for ( i = 0; i < nav.length; i++ ) {
    $(nav[i]).bind( 'mouseover', mMouseOver );
    $(nav[i]).bind( 'mouseout', mMouseOut );
    $(nav[i]).bind( 'click', mClick );
  }
});

Whenever a user hovers over the navigation item our script will call ‘mMouseOver’ function. When the user hovers out of the navigation item our script will call ‘mMouseOut’ function. And when the user clicks on the navigation item, our script will call ‘mClick’ function.

Step 5.1: Mouse over

Let’s create a “story board” for our mouse over animation.

On 'Mouse Over':
  • Change the navigation menu image (glow) and change the cursor to pointer.
  • The navigation will move up a bit.
  • The white box will move down.
  • The white box and the navigation menu will both down.
  • The navigation menu and the white box will move up to its final position.
  • And change the navigation menu image to its original state.

Okay let’s add these functions below the previous script:

function _getHPos( id )
{
  for ( i = 0; i < nav.length; i++ ){
    if ( '#' + id == nav[i] ){
      return i*(-98);
    }
  }	
  return 0;
}

function mMouseOver(e)
{	
  $(this)
  // stop any animation that took place before this
  .stop()
  // step 1. change the image file and change the cursor 
  .css({backgroundImage: 'url('+site_url+'img/nav-over.jpg)',cursor: 'pointer'})
  // step.2 move up the navigation item a bit
  .animate({ backgroundPosition:'(' + _getHPos( this.id ) +'px -30px}'},"fast",
    // this section will be executed after the step.2 is done
	function(){ 
	  $(this)
	    .children()
		  // step. 3 move the white box down
		  .animate({backgroundPosition:'(0px -40px)'},20)
		  // step 4. move the white box down
		  .animate({backgroundPosition:'(0px -20px)'},"fast");
	  $(this)
		// step 4. move the navigation item down
		.animate({backgroundPosition:'(' + _getHPos( this.id ) +'px 50px)'},"fast")
		// step 5. move the navigation item to its final position
		.animate({backgroundPosition:'(' + _getHPos( this.id ) +'px 25px)'},"fast");
	  // store the parent element id for later usage
	  var parent = this;
	  $(this)
		.children()
		  // step 5. move the white box to its final position
		  .animate( {backgroundPosition:'(0px -45px)'},"fast",
			// this section will be executed after the step.2 is done
			function(){
			  // step.6 change the image to its original image	
			  $(parent).css({backgroundImage: 'url(img/nav.jpg)'});
			});	
	});
}
 

I need to explain several things here:

  1. The _getHPos is use to adjust the horizontal background position navigation for each item. For example, the ‘Home’ item background will start from 0, the ‘About’ horizontal background position starts from -98px, and so on.
  2. Also notice that early in the function we invoke the ‘stop’ function. We do this to ensure whatever animation was running before the ‘mouse over’ event has stopped. Why? We will add another animation later on for the ‘mouse out’ event. Now let us suppose the user hover over an item and then quickly move the mouse pointer some place else and again quickly hover over the same item. If we do not stop the animation before each event, there will be a delay because some part of the animation will be queued or even worse the animation will become inconsistent and annoy the user.

Step 5.2: Mouse out

Now that is done. Let's create "story board" for the 'mouse out' event

On 'Mouse Out':
  • Move down the navigation item.
  • Move the white box down.
  • Move the navigation up.
  • Move the navigation item up to its original position.
  • Move the white box to its original position ( invisible ).
  • Return the cursor to normal.

The code:

function mMouseOut(e)
{			
  $(this)
  // stop any animation that took place before this
  .stop()
  // step.1 move down navigation item
  .animate({backgroundPosition:'(' + _getHPos( this.id ) +'px 40px )'}, "fast", 
    // this section will be executed after the step.1 is done
    function(){
      // step.2 white box move really fast
      $(this).children().animate({backgroundPosition:'(0px 70px)'}, "fast");
      // step 3. move navigation item up
      $(this).animate( {backgroundPosition:'(' + _getHPos( this.id ) +'px -40px)'}, "fast", 
      // this section will be executed after the step.3 is done
        function(){
          // step 4. move navigation item ot its original position
          $(this).animate( {backgroundPosition:'(' + _getHPos( this.id ) +'px -25px)'}, "fast",
            // this section will be executed after the step.4 is done
            function(){
              // move white box to its original position, ready for next animation
              $(this).children().css({ backgroundPosition:'0px -60px'});
            })
        })
    })
    .css({backgroundImage: 'url(img/nav.jpg)', cursor: ''});
}

Step 5.3: Click

Almost there! Now we need to handle when a user click on the navigation item.

function mClick(e)
{
  location.href = this.id;
}

Of course you can point to wherever location you see fit here. This particular function will direct your browser to [current_url]/[navigation_id] so for ‘home’ it will be ‘[current_url]/home’, for ‘about’ it will be ‘[current_url]/about’ and so on.

Step 5.4: Current page indicator

Of course we need an indicator when we are already on a page. For that we need another CSS class. We will call that class ‘active’. For instance if we are now at 'home' the HTML file will become:
<div id="home" class="pri-nav active"><div><a href="home">home</a></div></div>
Or if we are at 'about' it will become:
<div id="about" class="pri-nav active"><div><a href="about">about</a></div></div>
and so on.

So now the idea is after a page is loaded our script will check to see which navigation item has the ‘active’ class. We then apply an animation effect. And we need to ensure any other events ( ‘mouseover’, ‘mouseout’, ‘click’) will not cause any animation effect on this 'active' item.

For that we need to change our code a bit. Here is the complete code after the changes:

var site_url = '';
var nav  = [ '#home', '#about', '#services', '#solutions', '#contact' ];

$(document).ready(function(){
  setBkgPos();

  for ( i = 0; i < nav.length; i++ ) {
    $(nav[i]).bind( 'mouseover', mMouseOver );
    $(nav[i]).bind( 'mouseout', mMouseOut );
    $(nav[i]).bind( 'click', mClick );
  }

  for ( i = 0; i < nav.length; i++ ) {
    // element with ‘active’ class will  start animation 
    if ( $(nav[i]).get(0).className.indexOf('active') >= 0 ){
      $(nav[i])
      .animate({ backgroundPosition:'(' + _getHPos( nav[i] ) +'px -30px}'},"fast",
        function(){ 
          $(this)
            .children()
            .animate({backgroundPosition:'(0px -40px)'},20)
            .animate({backgroundPosition:'(0px -20px)'},"fast");
          $(this)
            .animate({backgroundPosition:'(' + _getHPos( nav[i] ) +'px 50px)'},"fast")
            .animate({backgroundPosition:'(' + _getHPos( nav[i] ) +'px 25px)'},"fast");
          var parent = this;
          $(this)
            .children()
            .animate( {backgroundPosition:'(0px -45px)'},"fast",
			  function(){
                $(parent).animate({backgroundPosition:'(' + _getHPos( parent.id ) +'px 25px)'},"fast");
                $(parent).css({backgroundImage: 'url(img/nav.jpg)'});
              });
        });
        break;
    }
  }
}); 

Finished!

And with that we have our entire nifty little menu.

Download a ZIP of the Site

View a Demo!

Enjoyed this post? Your vote is always appreciated!! Delicious StumbleUpon Float Digg

Comments

Leave a Comment
  1. Quite cool, although the tab almost (and sometimes does) move so far that the mouse ends up leaving the hit area or not actually being over the tab which is a little bit annoying as experience tells people that their mouse has to be over the button they want to click so I move my mouse down and the thing bounces again…

    Overall, I’d say this is a semi-neat little trick but nothing I’d ever use seriously simply from a usability point of view.

  2. The effect does look nice, and I think would work quite well in the real world - even with Javascript turned off :D

    Like will says, it takes a little knowledge about when/where to click, but I think you would learn that pretty quickly…

    Thanks!

  3. Just took a look over this demo file. It is amazing. I really love it. Great work.

  4. Wow, a nice effect, thx’s for sharing. Looking forward for another jquery tutorials.

  5. “ut since every menu item is unique, I do not see the advantages of using so I am going to use ”

    Give each list-item a ID, that’s what IDs are for.

  6. Cool effect.. Thanx

  7. Wow great tutorial. It’s like a flash menu. Thanks :)

  8. Perfect Tutorial…Thanks a lot :)

  9. nice but “Will” is right!

  10. Nice effect, it definitely can attract visitors and guide them to visit more pages :P

  11. Gravatar

    for-w-art

    would be cool if only the .png transparancy was set properly for explorer.

  12. Cool tut, thanks!

  13. Wick wickedy wick..! Keep up the good work guys…!

  14. Gravatar

    Robert Strong

    Should have made navigation into one single jpg file. This way you get less requests for images and the css for the buttons would have been like this: background: transparent url(images/nav.jpg) no-repeat scroll x y; where x and y would be the variables in px to define the coordinates for each part you want to show of the button. for the first button you would have x=o y=0 at a hover you would have x=0 y=-30px (or whatever the height of the image is), for the second button you would have x=100px (or whatever the length of the button is) and y=0 on hover state you’d have x=-100px y=-30px and so on and so forth. Thus you will have less bandwidth used and get only one request for the navigation image. Hope you guys understood what i just said. :P

  15. Gravatar

    Rogerthat

    Its really cool effect, it works right on Firefox but when i preview on IE7 i can see a white border around the rectangles and the header background because is a png, what could i do with it?.

  16. Gravatar

    Adam Griffiths

    It’s a nice tutorial but when you give the extended code for the navigation, there’s only one comment.

    “// element with ‘active’ class will start animation”

    To edit the code slightly you really would have to go through it using trial and error, because there isn’t much explanation of the code. The code is presented as “The code:” and there is no explanation of it.

    It is a nice effect, but a little more explanation would make it so much better.

  17. This is a great tutorial!

  18. Great Brother Really ………….. So much of Thnaks To u…

  19. Nice tutorial, thanks for the information.

  20. Nice effect. Thanks for the tut.

  21. jQuery is the bomb! There’s too many lines of code for my liking though. I personally think this tutorial has gone overboard with effects when simple sliding animation would have been enough. Great tut nonetheless.

  22. @ Ben Griffiths

    You would think so! But I still have to tell my parents that they don’t have to double click on the internet :p

  23. The tutorial says JPGs but in the final results folder its all PNGs.. Please fix..

  24. Good work. I’m glad and grateful that you took the time to help a mere mortal like me understand jQuery better. Your code samples are great, and after visiting the link (placed near the top) to the fully working example, I read the whole article. Plus the comments.

    At any rate, the functionality and the know-how are indisputable. The only thing I would do differently in my implementation (just as soon as I have time) are the usability & behavior aspects.

    Yes, as far as using the actual navigation scheme, probably 9.5 out of 10 people reading this article will “get it” and — because we like working with jQuery — will even find it exciting. However, catering towards a non-technical audience, as many of us most likely do, it might be more to our advantage to adjust the code and the graphics a little bit, so that the click-able tabs remain visible (perhaps after bouncing) where you clicked.

    It’s probably just a psychological thing, and it certainly isn’t meant to reflect in any negative on the code tutorial. Thanks! Keep up the good work.

  25. I like this tut. Thank’s a lot.

  26. Gravatar

    endorphine

    You should try to use unordered list for the menu!
    And you forgot overflow: hidden; on .pri-nav a{ it’s just to be sure you won’t ever see that text. Sometimes people use text-indent: -500px; and on my 1680×1050 screen I can see the text on the left side of the screen.

    Still a good tut!

  27. Dude. Thats freaking awesome!

  28. Yeaaah!! A new post with css and jquery couldn’t be better :D

  29. I like the tutorial, but I find the menu a bit annoying to use to be honest :-)

  30. Excelent write-up Joash and the navigation is stunningly beautiful.
    If I may, I have a few sugestions:

    Should have made navigation into one single jpg file

    Robert Strong is right, you can reduce the number of HTTP requests to just one by combining the tabs into a single sprite and using the background-position property to adjust it appropriately.

    Also, I would recommend using unordered lists instead of div’s to keep the mark-up as semantic as possible, and then just assign a display:block; property to the list items, making them function just like a div. You can asign id values just like Tor Løvskogen said to traverse the DOM.

    Additionally, jQuery is a lot more than just effects - you can use it to shorten and clean up JS code.
    for example, in the first code snipplet of Step 5, instead of:

    var nav = [ ‘#home’, ‘#about’, ‘#services’, ‘#solutions’, ‘#contact’ ];
    $(document).ready(function(){
    setBkgPos();
    });

    for ( i = 0; i < nav.length; i++ ){
    [whatever]
    }

    Could be reduced to:

    $(document).ready(function(){
    $(#navigation div”).each(function(i) {
    [whatever]
    });
    });

    Or something like that… there may be syntax errors (I didn’t test it). In essence, you can save creating a function and using jQuery’s powerful DOM selection utilities, as well as its .each() utility to tidy up and reduce the # of lines of code.

    My two cents and again, excellent tutorial. You should be commended for the edetail and construction of graphics to make it easier to read and understand! Looking forward to your next tutorial!

  31. Nice tutorial!

    @Jacob - good points!

    Other suggestion: Maybe a fallback for IE6 … or a PNGfix with JS?

  32. What a nice effect! Thanks for sharing this!

    David Carreira

  33. At Step 4, when showing the CSS, major typo error !

    You’ve got the background images as JPEG’s, but you mentioned a step earlier to save them as PNG.

    1. body {
    2. background: url(../img/body-bkg.jpg) repeat scroll;
    3. margin: 0;
    4. padding: 0;
    5. }
    6.

    11. #header {
    12. background: url(../img/hdr-bkg.jpg) repeat-x scroll;
    13. height:181px;
    14. }

    should be:
    1. body {
    2. background: url(../img/body-bkg.png) repeat scroll;
    3. margin: 0;
    4. padding: 0;
    5. }
    6.

    11. #header {
    12. background: url(../img/hdr-bkg.png) repeat-x scroll;
    13. height:181px;
    14. }

  34. Gravatar

    Davy Kestens

    am i the only one whose browser width of the demo-page is way too much and get a horizontal scroll-bar?

  35. I went through this step by step, and no JS loaded. I have the buttons, but once I indent the text off the screen, the buttons are not clickable. As far as I can see, I have the exact CSS/XHTML from the tut. Can anyone point me in the right direction?

  36. Extremely buggy =/

    FF2 on OSX

  37. @JC
    Is Javascript in your browser enabled?

    @tutorial
    Very nice, this just jumpstarted me to a design idea I’ve been struggling to come up with. Thanks!

  38. I’m using FF3RC1 (Firefox 3 Release Candidate 1), and the links are causing trouble. Here is what showed up when I clicked on a link:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    AccessDenied
    Access Denied
    41ED9D0C58573FD3

    7/l3zPUhDvMuq1czAlqW9K27QtaSdJA6pubAsj8HMb8WCM6ElMvDBMqf4kkUd7Ck

  39. This is what is says:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    AccessDenied
    Access Denied
    213C0F92520E7A12

    UT/91HPclC+LfKPPwgzkfbrdFyRhEX5lUe88BQjr+m5SI7OA5k1fqcWzPb50655a

  40. It’s a pretty cool effect but not really practical at all. Really goes against any sense of usability and cross browser issues could become potential problems

  41. the article is well documented, I like your style.
    But I reckon the effect is too clumsy. Specially the white background going up when you move the mouse out of the tab. Just my personal opinion of course.

    The online demo looks perfect in Opera (9.27) and IE7.
    On Firefox [Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14] looks like after the tab finish its effects it gets refreshed one last time (or sometimes twice).

    In IE6 (XP) the effect is smooth, but pngs transparency is not working. And afaik you can’t use the AlphaImageLoader since you’re playing with the image-position… maybe you can use some tricky js lib for that.

    Keep up the good work!

  42. Sorry, but this navigation concept totally sux.

  43. Fantastic tutorial, thanks for the knowledge - I knew jQuery was flexable and fast but, you’ve made this look like child’s play.

  44. @JC - Got a live page we can look at?

  45. nice work thumbs up

  46. hey thanks a bunch for thist tutorial…. i´ve been searching something like this…

  47. Your example realy need some png work since it sure looks funny in IE6.. other then that, a well written tutorial

  48. Cool efect… it came out quite nice. But i think rather than using jquery for this it would have been better to write the javascript your self. It would only take a couple lines of code and it would be much simpler.

  49. thanks alot, i love all your tuts

  50. Gravatar

    Action discrète

    What about making it multi-levels ?

  51. I love the illustration of storyboarding your effects. keep up the good work. Probably not something I’d use, but the ideas you present are great.

  52. heavy

  53. I dont like it. Technically its fine but as an Interaction Designer I can’t say it makes much sense to do it like this. Its quite poorly thought out.

  54. I like it a lot, but I’m having a problem, If you click in the navigation and the mouse isnt directly over the link (home.html) the link will use the div’s id (home) and bring you to a page not found, im sure its because of this js code :

    function mClick(e)
    {
    location.href = this.id;
    }

    is there a way to make it work?

  55. I fixed a little problem with clicking on the buttons
    change the mClick(e) function to this:

    function mClick(e)
    {
    var link = “.php”;
    location.href = this.id + link;
    }

    this will let you click ont he button and not bring you to a dead link.

  56. Effective effect :D

  57. Eeeeeh… gets kinda annoying but good tut any way

  58. Gravatar

    Phil Gill

    Not only is the effect decent, but the article is very well-written. Great work mate!

  59. This may be a bit… silly of me. I’m not nearly as advanced as many of those commenting here are, but I stumbled upon this and managed to make it work on my own. There is a slight issue with the appearance in IE6, though.

    My question is a bit more… awkward.

    What text editor is that? I love how it looks and I want to use it.

  60. great work. thanks. i will try to do but i know i cant:)

  61. very useful tutorial and great job ! thanks a lot joash!

  62. niiiice tutorial. Adds a nice effect too! Shall be bookmarked & followed later!

    keep up the good work!

  63. A very clear tutorial - and yet another that features jQuery - I’m sure if readers hadn’t already used the excellent library, they’ll be rushing to check it out now :)

    thanks for posting.

  64. No funciona en ie, va funciona pero muy mal :S

  65. How to fix scritp?
    Because it still doesnt work.
    If I’ll change it to

    “function mClick(e)
    {
    var link = “.php”;
    location.href = this.id + link;
    }

    it’s still buggy for me.
    How to change it to something usefull ? :p

  66. I have a question: When I add the “active” parameter behind the pri-nav class in the link to contact.html, it does open contact.html, but the picture in the menu first has to find the contact picture in nav.jpg. So everytime I click on contact, I first get an animation of the index picture moving to the contact picture. How can I fix this?

  67. PERFECT ! I m new beginner I could not get it but super.

  68. Very nice. Would be great if the animation would not start over when you wiggle your mouse on a button. It could probably be solved if a setTimeout was added for the mouseout event instead of having the animation start right away. The mouseover event could then clear the timeout so if the element lost focus for say 100 millisecs, the animation wouldn’t fire.

  69. Very nice effect.. Great work thanks :-)

  70. Perfect… brilliant… outstanding… but… you can do the same stuff in under 10 minutes in flash without having to code so much. And if you’re thinking about SEO just add links at the top and bottom of the page and you’ll be fine, you can easily integrate them in the design.

  71. Gravatar

    Ebot Tabi

    Hey man thanks you know, it is the best tutorials i have ever met on this area, thanks a hundred,
    i will bve greaful to have more on jquery like tutorials on web 2.0 based on jquery.

  72. why not use mootools.net? this has some bugs.

  73. Thanks for the script. We can use them in variations. I have modified it to my needs but I do have a problem or u may say a request if anybody can help me it would be great.

    Problem:

    I can not figure out how to modify “active” element for other pages of my website. I know that in navigation.js we have this “.indexOf” for activating home page, I want to do the same for my other pages. I need help in coding the navigation.js file because I am amture in js.

    I hope somebody can help. Thanks in advance…

  74. css layer examples / properties and layer attributes
    http://css-lessons.ucoz.com/css-layer-properties.htm

Add a Comment

Note: We use Gravatars on NETTUTS, they are little icons that appear next to your name on this site and on many others. You can get a Gravatar account for free and any other site that supports it will show your avatar too!

 

Trackbacks

Leave a Trackback