Large clickable boxes as navigation with CSS and DOM

A client asked for a proof of concept how you could create large clickable boxes as a navigation. They wanted the whole box clickable, and if the link is a section link with child elements they wanted an indicator that there is more. The links without children should simply send the user to the site, the parent links should not follow the main link, but expand the children.

Check out the demo page: large boxes as links and feel free to get inspired. If wanted, I can write a quick explanation on how it is done and you could send sexier styles.

6 Responses to “Large clickable boxes as navigation with CSS and DOM”

  1. Fred Says:

    It looks great, but it is not very comfortable when you have habit to use middle mouse click to opens links in new tabs. I tried to made there some changes. Instead of calling onclick event, call mousedown
    boxnav.addEvent(lis[i],’mousedown’,boxnav.navigate,false);

    and in function navigate instead of window.location=target this

    var DI=document.uniqueID;
    if((DI&&event.button==1)||(!DI&&e.which==1)){
    window.location=target;
    }
    if((DI&&event.button==4)||(!DI&&e.which==2)){
    window.open(target,”,”);
    }
    But it seems me bit messy.

  2. Frantisek Malina Says:

    Thank you for a nice example.
    I tried to alter your demo so it suits my needs but I failed.

    I need clickable boxes – deals (the whole box with a class=”deal”) to point users to the deal link specified in the first link of the same box.

    I started to use jquery so there might be a way to write it in a few lines I just do not know how.

    I tried this

    $('*.deal').click(function() {
    window.location = $('a:first', this).attr('href');
    });

    but it seems not working at all.

    My markup look like the following:

    <div class="deal">
    <h1>< *a hre*f="#">Lorem ipum in a div</></h1>
    <p>le "deal" element should be clickable pointing to the first link of the deal box.</p>
    </div>

    <ul id="deals">
    <li class="deal">
    <h2>< *a hre*f="#1">Lorem ipsum</></h2>
    <ul>i>Feature 1</ul></li>
    <li>/li>
    </li></ul>
    s="deal">
    <h2>< *a hre*f="#2">Dolor sit amet</></h2>
    <ul>i>Feature 1
    <li>Feature 2</li>
    </ul>

    Could you possibly help me please?
    Thank you

  3. Frantisek Malina Says:

    The markup in the previous comment is totally broken due to comment filters, but I hope you know what I mean.

  4. Frantisek Malina Says:

    Right, solution can be found here:
    groups.google.com/group/jquery-en/browse_thread/thread/6bca9e6421a37f42

  5. Assaf Says:

    Hi Chris,

    I’m looking for a hover effet that will open a sub-menu.

    In your example, you open a sub-menu but only when the “CSS showcases” link is clicked. I’d like to have the sub-menu of “CSS Beauty, Style Reactor, …” opened when “CSS showcases” is hovered (somewhere aside).

    Do you know perhaps of such control?

    Best regards,

    Assaf

  6. Fabián Link » How to Create a Block Hover Effect for a List of Links Says:

    [...] Large clickable boxes as navigation with CSS and DOM [...]

Leave a Reply

Wait till I come! is the blog of Christian Heilmann , a developer evangelist living and working in London, England. Download vcard.

Feed me, Seymour: Entries (RSS) and Comments (RSS).