$(document).ready(function(){ var headerH = $('.navbar').innerHeight(); $('.subP').css({"padding-top": headerH + 'px'}) $(".tab_content").hide(); $(".tab_content").css({"opacity":"0"}); $(".tab_content:first").show(); $(".tab_content:first").css({"opacity":"1"}); $(".tab_tab a:first").addClass('active') $(".tab_tab a").click(function () { $(".tab_tab a").removeClass("active"); $(this).addClass("active"); $(".tab_content").hide() $(".tab_content").css({"opacity":"0"}); var activeTab = $(this).attr("rel"); $("#" + activeTab).show() $("#" + activeTab).animate({"opacity":"1"},300) }); });