views:

189

answers:

2

I'd like to use something like jQuery's accordion menu, but have the triggered elements be angled. I'm guessing this isn't possible, but thought I'd see if anyone has tried it before.

A few less than ideal ideas:

  1. Go old-school and work with image maps. I haven't used an image map in years though, so that'd take a bit of testing to see if it's even possible.
  2. Use several target areas for each navigation element and position them in a staggered layout. Pretty hacky and bloated though.
  3. Use the rotate capability of fancy browsers. This actually doesn't seem too bad, but obviously not viewable for most users. Also not sure how that would affect the content areas - but could be explored.

Let me know if any clarification is needed.

Here is a sketch of the concept: concept sketch

A: 

Hey Matt!

Yes I believe this can be done. Thinking off of the top of my head this is what you would do. Create angled images for the buttons first. Put those images in order on the HTML markup, with a div element in between each one. So the markup would be something like this.

<img id="bttnOne" src="buttnImg1" onclick="openContent('bttnContentOne');" />
<div id="bttnContentOne" style="display: none">
   content1 content1 content1
</div>

<img id="bttnTwo" src="buttnImg2" onclick="openContent('bttnContentTwo');" />
<div id="bttnContentTwo" style="display: none">
   content2 content2 content2
</div>

You will need to adjust the css to make these fit correctly. A float left on the elements would work well. Now that you have the HTML, you will need to create a function which I called openContent above. You can pass the id of the button being clicked on to that function if you want, or you can come up with a better way to do this.

The openContent function would look something like the following,

function openContent(eleId) {
   $('.activeContent').slideUp('fast');                           //Close the currently opened content tab
   $('#' + eleId).slideDown('slow').class('activeContent');       //Open the new one and set the class
}

Now, im not positive that the slideDown will look correct if it needs to slide to the right, or left. If it does not, then you could try using the animate functionality to get a slide left and right. This is a VERY rough example of how this could be done, so dont expect this code to work, but the main thought process is correct.

Hope this helps!

Metropolis



(EDITED)

The one thing that I personally do not like about that example is how the text also displays diagonally. I believe it would actually be better to go with rectangle boxes that "look" diagonal. Here is a rough ascii sketch :)

---------------------------
|      /| content content |
|     / | content content |
|    /  | content content |
|   /   |                 |
|  /    |                 |
| /     |                 |
|/      |                 |
---------------------------

Another thing I do not like about that particular implementation is all of the div tags that the extension creates for you. It is very inefficient at this point. Hopefully in the future we will be able to do those type of things easily. Right now though, if you want the content to actually be diagonal like that implementation is, you will need to have all of those div tags to get it.

Metropolis
Thanks for the reply Metropolis!Wouldn't there be a problem of the button target areas overlapping? That's my main concern, figuring out how to get the target areas to be angled, as opposed to rectangular, in which case they would overlap, rendering the target area on the bottom nearly unusable.Please let me know if I'm not fully grasping your concept.
Matt Crest
Re: your edit:Agreed on both fronts. I bet the diagonal paragraph thing could be overridden with CSS or hacking the JS though.I'm not a fan of all the extra markup it adds either, but at least it is generated by the script, instead of hard coded (marginally better IMHO).I'm still struggling to see how your method would work regarding the target areas. Perhaps I'll take a stab at mocking it up in the next few days and see for myself.Thanks again! I'd vote up your reply, but I don't have enough reputation points.
Matt Crest
Ah...I see what your saying. If the images are rectangle, the diagonal buttons could not bump up to each other. I have another crazy idea with that. Could you make the images be relative, and push each of them to the left so that they overlap the image to the left?
Metropolis
They could overlap - for sure. The issue is that when they are overlapping, the clickable/hoverable area also overlaps; thereby rendering the overlapped button.Here's a followup sketch (http://drp.ly/ar9c7). The red horizontal lines represent the target area (hoverable) for button 1. Button 2 then has just a tiny section at the top where a user can hover to activate it.
Matt Crest
I guess divs is the only way to go lol.....sorry man, I am out of trys. You are correct about those things. It may suck, but maybe you should wait until the internet catches up for this so it can be done correctly.
Metropolis
A: 

I was just pointed to a jQuery plugin that accomplishes this task pretty well (Diagonal Accordion). I have yet to test it, but it looks like it is limited to 45° angles, which is a bit of a bummer, but still pretty cool.

Matt Crest
Bonus - a fine gentleman on Doctype.com forked the Diagonal Accordion script to allow for any angle: http://doctype.com/possible-have-angled-elements-accordion-list
Matt Crest