[Zetaboard Code] Category Tabs- Biến Category thành dạng thẻ tab (phiên bản khác)

[Mr.P]

New member
Code name: Category Tabs
Tác giả: Sjaelen
Preview:
===================
Đặt code tại Below The Boards
Mã:
<script type="text/javascript">
if (location.href.match('/index')) {

$('#main table:first').after('<table><tr id="tabCat" style="text-align:center;"></tr></table>');

$('.cat_head h2, .h2center').each(function () { $('#tabCat').append('<td><strong>'+ $(this).text() +'</strong></td>') });

$('#tabCat').append('<td id="showAllCat"><strong>Show All</strong>');

$('#tabCat td').css('cursor','pointer');
$('#tabCat td').not(':first').css({'opacity':'0.5', 'filter':'alpha(opacity=50)'});
$('.category').not(':first').css('display','none');

$('#tabCat td').live('click', function() {
if ( $(this).is('#showAllCat') ) {
$('.category').fadeIn('250');
$('#tabCat td').not(this).animate({opacity:'0.5', filter:'alpha(opacity=50)'}, 250);
$(this).animate({opacity:'1.0', filter:'alpha(opacity=100)'}, 250);
}
else {
var b = $(this).index();
$('.category:eq(' + b + ')').fadeIn('250');
$('.category').not(':eq(' + b + ')').css('display','none');
$('#tabCat td').not(this).animate({opacity:'0.5', filter:'alpha(opacity=50)'}, 250);
$(this).animate({opacity:'1.0', filter:'alpha(opacity=100)'}, 250);
}
});
}
</script>
============================
 
Back
Top