Give this a try:
PHP Code:
<head>
<style>
div.div_3sg
{
width: 100%;
}
div.tab_3sg
{
border: 1px solid;
margin: auto;
clear: both;
height: 120px;
width: 98%;
padding-left: 4px;
}
#tabs li {
list-style: none outside none;
}
#tabs ul {
padding: 0;
border-bottom: 0 none !important;
}
#tabs li, #tabs li a {
float: left;
}
#tabs ul li{
font-weight: bold;
padding: 8px;
text-decoration: none;
cursor: pointer;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
<div id="tabs" class="div_3sg">
<div id="tabHeader" style="display:block; float:left;">
<!-- Tabs Generated Here -->
</div>
</div>
<script>
$.getJSON('3sgTabs.json', function(data) {
var items = [];
$.each(data.groups, function(id, group) {
items.push('<li id="tab-' + (id+1) + '">' + group.name + '</li>');
});
$('<ul/>', {
'class': 'tabCategories',
html: items.join('')
}).appendTo('#tabHeader');
});
</script>
</body>
Output generated is:
PHP Code:
<div id="tabs" class="div_3sg">
<div id="tabHeader" style="display:block; float:left;">
<ul class="tabCategories">
<li id="tab-1">Events</li>
<li id="tab-2">Groups</li>
<li id="tab-3">Information</li>
</ul>
</div>
</div>
Working demo:
http://www.stealthify.com/3sgto/projects/3sgTabs.php
Bookmarks