You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Advertise
Best Hosting Service
Categories
- CMS Tools (1)
- Coding (6)
- CSS (13)
- Fonts (16)
- Freelance (16)
- Graphics (880)
- HTML (6)
- Icons (21)
- Illustrator (1)
- Inspiration (45)
- Interviews (8)
- IPhone (1)
- Java Script (4)
- Jquery (1)
- Logos (7)
- Marketing (5)
- Megento (1)
- Mobile Apps Development (2)
- News Letter (1)
- Photoshop (5)
- Resources (3)
- Responsive Design (2)
- Tutorials (4)
- Twitter (6)
- UI Design (1)
- UX Design (3)
- Wallpapers (7)
- Web Design (45)
- WordPress (23)
- Work (9)
Tags
3D
Artworks
brush
clients
Create
CSS
CSS3
design
designs
developers
Download free fonts
Fonts
Free
free fonts
Free Icons
Freelance
freelance websites
Graphics
Icon
Icons
Illustration
Illustrations
Illustrator
Inspiration
Inspirational
Interview
Javascript
Logos
Photo
photos
Photoshop
portfolio
Poster design
Texture
themes
tutorial
tutorials
Twitter
Typography
UI design
Vector
Web Design
Websites
WordPress
Wordpress Themes



Tricks
These “sliding” style navigation bars have been around a while, I just thought I’d take a crack at doing it myself as the opportunity came up recently. Turns out it’s really pretty darn easy. I put two examples together for it.
The Idea
The idea is to have a highlight of some kind (a background or an underline) follow you around as you mouse over the different links in the navigation. This will happen with jQuery and it’s animation abilities. As such, the “magic line” will only be appended via JavaScript. Once added to the list and styled, as you mouse over the different links, it figures out the left positioning and the width and animates to match.
HTML
Typical list here…. It has the “group” class because it’s going to be a horizontal row and will need the clearfix so it has height. The ID is for the JavaScript to target it.
Notice the .nav-wrap div around it. That is used because of the styling, the bars go full width of the screen the but the navigation is centered within. This centering brings up an issue when we start the JavaScript.
CSS
Do the ol’ inline list elements with floated left anchors to get the list horizontal and avoid stairstepping. The magic line is absolutely positioned under the bar, so that it doesn’t cause jitter (mouse over a link, animates over, mouse is now on magic line not the link, animates back, etc.) Everything else is purely stylistic.
jQuery JavaScript
Issues
Opera is weird about it. It makes the original width of the magic line the full width of the nav bar and shortens it from the right on hovers. I haven’t been able to figure it out. If you do, awesome, let me know I’ll update this article and demos.
Alternate Version
Check out the demo link below for an alternate version that uses a background instead of a line, and animates color as well as position and width. Basically the same, except the CSS is slightly different and the JavaScript pulls the color of the new list item from a rel attribute in the HTML.
Color animations in jQuery require the color plugin. I was just moaning about how it doesn’t work with RGBa color, and someone sent me a patch that does, which is included in the download. I’m really sorry, but I can’t remember their name! Speak up if it was you and I’ll update this and credit the patch to you.
All Yours
As always, feel free to do whatever you want with it. Preferably, use it in corporate projects and earn wheelbarrows of cash.
View Demo Download Files
Related Posts