Advertise
  • Home
  • Menus
  • Blog
  • Contact

Cookies are currently necessary for this site to operate properly.

    Categories

    • Development (9)
    • Extras (3)
    • General (6)
    • Tutorials (6)

    Archives

    • April 2010 (3)
    • November 2009 (4)
    • October 2008 (1)
    • September 2008 (8)
    • August 2008 (1)
    • July 2008 (4)

    Most Recent Posts

    • 5 Free CSS Menu Builders
    • CSS Menu Builder Video Tutorial
    • Site quite unstable – FIXED
    • Centering a menu using either CSS, MooTools, jQuery or just plain JavaScript
    • 50.000 downloads since launch

    My Writing

    If you don't like dry sarcastic humour, please don't read any more of this blog, because I have a tendency to use it without thinking about it.

    This blog will mainly be used as a development log, since I am not a big blogger and don't really have anything worth saying, though I might write a few tutorials and suggested usage articles along the way.

    Oh by the way, in this blog, which is currently the only blog I am active on, I go by the original name of admin. I will not be commenting that much, but when I do, this is the name you will see.

Javascript tabbed content example using CSS Menu Builder and MooTools

You have probably seen tutorials about tabbed content scripts, since they are all over the net, just go to Google and search for javascript tabbed content tutorial and you will get thousands of results. That is why I am not going to write one here, but instead just show you how it looks when applied to a css menu generated via this site.

The example uses one of the new menu styles added to the horizontal menu builder, furthermore it uses MooTools 1.11 as the javascript framework, but you can easily change this to fit your favourite framework.

The code is supplied in each tab, so you can quickly apply this to your site, by copy/pasting the code from the tabs to your own site.

Example 1

By creating a menu image where the tabs are upside down, you can easily add the tabs to the bottom of the container, as the second example shows.

Example 2

To get started with creating your own css tab menu style, go to the horizontal menu builder.

Other resources
A List Apart has a great tutorial on how to create your css tabs using the sliding doors technique. Here are the links for Part 1 and Part 2

TutorialBlog also has a list of 10 Different Ajax Tab.

At Dynamic Drive you can find many tabbed content examples along with css menus examples.

And at last, if you want a Windows XP styled tab script, you can find an excellent one over at dhtmlgoodies.com.

Update 27/09-2008

Due to the comment below, by Doug, I have made a modification to the tab script, so that if you should ever encounter similar issues, you can use the below examples for you site.

As stated in my comment below, the changes to the script are very simple to implement. In your tab links you will have to add a hash (#) before the link name and in the javascript you will need to change the last two lines in the “tabState” function from;

var ac = ael.getProperty(‘href’);
$(ac).addClass(‘active’);

to

var acu = ael.getProperty(‘href’);
var ac = acu.replace(/#/, ”);
$(ac).addClass(‘active’);

Furthermore, while trying to figure out what could have caused the issue, I encountered a variable that was not set. The scripts here have been corrected, but if you have used the script and want to correct this all you need to do, is change the following line in the “initTabs” function;

e = new Event(e).stop();

to

var e = new Event(e).stop();

But enough talk from me, I could go on all day, here are the links to the examples using the different javascript.

Example 3

Example 4

Please note that even though an issue occurred on Dougs site, I tested it in IE7 and it worked fine, the issue might have occurred due to multiple javascript not being able to play toghether.

September 6th, 2008
Comments (2)
Filed under: Extras, Tutorials

2 Responses to “Javascript tabbed content example using CSS Menu Builder and MooTools”

  • Comments
  • Pings
  1. doug says:
    September 26, 2008 at 19:43

    I was playing around with this and in IE7, when you click on the tab, let’s say in the <a href you have “tab1″, then it is trying to open a full url like mysite.com/tab1 instead of opening the content in the tab. It is working perfectly in Safari and Firefox Mac. I have not tested this on Firefox windows. I would imagine it is just an issue with IE7. I tested in IE6 and it worked perfectly. I am curious what you think the problem might be?

  2. admin says:
    September 26, 2008 at 23:25

    The above comment has been resolved.

    I do not know what caused the error, it might have been another script that interfered with the tab script or it might have been another issue. But the script in it self works in IE7, as well as FF, Opera, Chrome and Safari.

    I will be adding another version of the script that Doug and I used for his site, so that anybody else that might encounter so mysterious errors have an alternative.

    Basically the new script only changes a few thing to the original, in the list menu, the a href’s will be changed from a href=”tab” to a href=”#tab”.

    In the script itself, the change is made to the last couple of lines in the tabState function, where it looks like this;

    var ac = ael.getProperty(‘href’);
    $(ac).addClass(‘active’);

    It has now been changed to the following;

    var acu = ael.getProperty(‘href’);
    var ac = acu.replace(/#/, ”);
    $(ac).addClass(‘active’);

    But as stated, I will be posting an update to this post, with links to examples of the new version.

Info

  • Information for advertisers
  • Terms of Service
  • Privacy
  • License

About

This is my small contribution to the world of web designers, programmers, web enthusiasts and others who have helped me or need help or just don't want to take the time to learn how to do this in photoshop etc.

These menus are licensed under the MIT license

Clicky Web Analytics
V:II | XHTML | CSS | Bluehost | GA & Clicky
2008 - 2010 | This is a [Super Simple Services] site.