views:

73

answers:

3

I am VERY new to JQuery. Just trying to get a feel. I like the tab feature demoed here: http://jqueryui.com/demos/tabs/#mouseover

I really like this, however I would like it to act a bit more like a Menu. Particurally I would like the tab content to apear OVER the content on the page (like a menu). Also, just as when I rollover the tabs the content changes, when I am not rolled over any tabs(or maybe instead when the user clicks anywhere else on the page) I would like the tab content to go away(like a menu).

So really I want to use it as a menu. If someone knows of a menu control that could solve my problem that would work too. I just like the fact that when I hover over an item a div popups up. I want to put some text and two buttons in each div.

Thanks!

This is what I had originally: This in the Header:

$("#tabs").tabs().find(".ui-tabs-nav").sortable({ axis: 'x' });
$("#tabs").tabs({ event: 'mouseover' });

And this in the body:

 <div id="tabs">
            <ul>
                <li><a href="#tabs-1">First</a></li>
                <li><a href="#tabs-2">Second</a></li>
                <li><a href="#tabs-3">Third</a></li>
            </ul>
            <div id="tabs-1">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
            <div id="tabs-2">Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.</div>
            <div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div>
        </div>
+2  A: 

jQuery supports a very rich plugin model. You may want to look at a Menu Plugin rather than trying to manipulate the tabs to work like a menu.

Josh
Will I be able to show a div when I roll over a menu item rather than another list of items?
kralco626
You can put whatever you like in any LI element, so you should be able to just stick a div with your content in it.
Josh
That sounds cool. Will I be able to keep my theme? I'm not really sure how this works. I created a custom theme on the jQuery site, which I think is really cool. So when I create an ul and call the .Tabs() function on it, it created a tab thing with my theme. Will I(and how) be able to apply my theme to a third party menu addon?
kralco626
Themeing is a little different. the jQuery UI theme framework is based on a set of "pre-defined" CSS classes that should be applied to specific elements to achieve a cohesive look. Unless your third party plugin applies those classes it won't have the theme. However, you could look over the theme documentation and put those classes in the markup yourself. Aside from that, you would have to actually modify the JavaScript. I suggest it is worth looking for a plugin that supports the themeing.
Josh
Josh - thanks for the info. I'm really new to this so i didn't know. I'll look around for a plugin that supports theming. Would it support "theming" in general? or am i looking for it to say it supports the themes that can be created on the jquery site?
kralco626
The jQuery UI theme framework is very specific. It would need to support those themes to work out of the box. However, if you were feeling up to it, you could dive in and add those theme classes yourself.
Josh
I would i just don't know how. Like I said i'm really knew to this. I would want something that worked outta the box and as I got more familair start modifying stuff to fit my own needs. Thanks for your help.
kralco626
A: 

Here's an example of how to achieve this sort of behavior using jQuery. The example is very plain, but you can style it however you want.

Jeff
I tried your example. I posted my original code in my question above. My style was applied automatically. How can I apply my styles to your example?
kralco626
A: 

The styling seems to break when absolute positioning is applied. Any ideas how to fix it?

Tony