Posted on Tuesday, April 29th 2008 at 13:58

Introducing the Lab

5 comments so far | Digg | del.icio.us

DevKick has a new section called the Lab. DevKick Lab is a growing repository of web development experiments that we conduct using technologies like jQuery, CSS and HTML.

:path

Bundled with the grand opening, I will release the first version of a new jQuery selector called :path. :path is a very useful selector that automatically adds an active state to all your navigational elements. Normally, this is done server-side or by adding lots of redundant classes to each navigational element and use descendant selectors in CSS. To simplify this process for front-end developers or designers, :path filters out anchor elements where the href attribute matches the window.location path, including ancestors and lets you style those easily using jQuery and CSS. The package also includes a :current pseudo-class that targets the anchor that links to the current page.

More about :path and active states in a forthcoming blog post.

In time, I will also move my previous projects here, such as Galleria and Tripoli.

Leave a Reply




Note: rel="nofollow" applied. Spammers step back.
No HTML allowed except <p> (paragraph)

5 Responses so far.

Permanent link At 4:33 pm on May 1st, 2008 , Wes wrote:

Seems like a great tool. I guess my only question is what is wrong with the method of body id’s and navigation element id’s? Using jQuery some people might miss out on the styling.

For instance:

Home
About

….

CSS:
body#index #nav_index, body#about #nav_about { /* active nav info */ }

Permanent link At 2:45 pm on May 3rd, 2008 , admin (author) wrote:

@Wes: Have a look at our latest post http://devkick.com/blog/the-visual-active-state-popular-techniques-and-examples/

It explains some of the pros and cons. I prefer the jQuery route myself.

Permanent link At 11:36 am on May 6th, 2008 , Eugene Efimochkin wrote:

OK guys, :path is nice but there’s a great problem there. I dealed with it once I was hired to my current job (http://www.itech-design.ru). The problem is that you make a link _look_ like it is not a link, when it obviously _is_ a link. It even acts like a link (and if you prohibit it’s default behaviour with script you are going one step more the wrong path). My rule of thumb for visual states and links is: when you don’t need a link, don’t make it. That’s it. You see, we use server-side page generators most of the time, hence we _can_ remove the <a></a> garments each time we don’t need a link (performance is the question — but it always was dealable anyway). It is possible nowadays.

When we create static pages - why not think a bit and find a way to develop a template based site that doesn’t have links where we don’t need them? It is also possible with modern tools (damn, it is even MORE possible when we use just Notepad)!

Here in ITECH.group we don’t use such tricky JavaScript «link tortures» for at aleast a year (just since the moment I was hired), you can check our portfolio. When we don’t need a link - we don’t put it.

Permanent link At 11:52 am on May 6th, 2008 , David (author) wrote:

@Eugene: You raise a valid point, but it does not necessarily rule out :path. :path does not tell you how to style your active or current links, it’s just a front-end alternative that pulls active hrefs automatically. Nielsen recommends that you should not have a link that points to the current page, just as you say, that’s why :path comes bundled with :current. This example replaces the anchor that points to the current page with it’s containing text (thus removing the anchor):

$(’ul a:current’).each(function() {
$(this).replaceWith($(this).text());
});

Permanent link At 8:01 am on August 23rd, 2008 , Jurgen Posselt wrote:

I just discovered your web site yesterday and in a nutshell, you guys have restored my faith in the internet. How long have you been around? KEEP UP THE GREAT WORK. I love this site !!

DevKick News RSS

24 Kick Ass Portfolio Designs
exactly.
 17th of June at 9:07 pm
Using CSS to Fix Anything
Noupe shares some quick tips on how to avoid easy pitfalls when creating your CSS layout.
 17th of June at 11:14 am
2008 Design Trends
So what's hot now' Pencil sketches, handwritten notes, card stocks, watercolor effects, collage art, script fonts, grungy and splatter ink backgrounds etc... Some nice visual examples.
 16th of June at 10:04 am
10 Video Tutorials for Learning Basic Web Design Skills
Some people can read instructions on how to do things and can immediately go out and do them without any problems. But others need to see things done before they fully grasp how to do them.
 16th of June at 10:03 am
UTF-8: The Secret of Character Encoding
Character encoding and character sets are not that difficult to understand, but so many people blithely stumble through the worlds of programming without knowing what to actually do about it.
 12th of June at 11:17 am
jQuery UI v1.5 Released
"When we first started with the UI project, we set out to build a generic, basic, and simple way of adding and extending core interaction to DOM elements. However, we soon found that our approach wasn't working for UI."
 10th of June at 9:55 pm
The PHP Benchmark
The PHP Benchmark was constructed as a way to open people's eyes to the fact that not every PHP code snippet will run at the same speed. You may be surprised at the results that this page generates.
 9th of June at 1:27 pm
Introduction to CSS3 - What is it?
This article marks the first of several, providing an introduction to the new CSS3 standard which is set to take over from CSS2.
 9th of June at 9:24 am
Planning a Semantic Web site
This article leads you through the aspects of both information architecture and general infrastructure you need in place to truly take advantage of this burgeoning opportunity.
 8th of June at 5:49 pm
Why we skip Photoshop
7 reasons why the 37signals team skips photoshop.
 8th of June at 8:25 am

From the lab

Latest Components RSS

Component Categories