Say "Hello!"

  • This field is for validation purposes and should be left unchanged.

Tabbed content


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<style>
    #info {font-family:Arial, Helvetica, sans-serif;position: relative;float: left;width: 427px;padding: 2px 0 20px 50px;}
    .tabs li {float: left;}
    .tabs a {color: white;text-transform: uppercase;font-size: 16px;width: 120px;padding: 6px 10px;margin: 0 2px 10px 0;background: #6D6E71;text-decoration:none;}
    .tabs li.active a {text-shadow: 0 0 9px rgba(256, 256, 256, .8);color: #333;}
    ul {list-style: none;}
    ul.item {padding-left: 11px;}
    ul.item li {float: left;}
</style>
<div id="info">
  <!-- NAVIVATION -->
    <ul class="tabs">
        <li><a href=".content1">Features</a></li>
        <li><a href=".content2">Models/Specs</a></li>
        <li><a href=".content3">Gallery</a></li>
    </ul>
<!-- TABBED CONTENT -->
    <ul class="item content1">
        <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</li>
    </ul>
    <ul class="item content2">
        <li>Ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</li>
    </ul>
    <ul class="item content3">
        <li>Dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
        </li>
    </ul>
</div>

<script>
    //Tabbed content
    $(document).ready(function(){
        $('ul.item').hide();
        $('ul.item:first').show();
       
        $('.tabs li:first').addClass('active');
        $('.tabs li a').click(function(){
        $('.tabs li').removeClass('active');
        $(this).parent().addClass('active');
        var currentTab = $(this).attr('href');
        $('ul.item').hide();
        $(currentTab).show();
        return false;
        });
    });
</script>

Back to Snippets Follow me on GitHub

Ashley Cameron logo
Blog