0
我正在使用一些jQuery代碼,它使用li項目來選擇顯示哪個標籤。 「標籤」只是div。這是jQuery代碼:傳遞PHP GET到一個jQuery函數
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
凡說李:第一,增加了活動類吧,我想弄清楚我如何可以根據一個PHP GET改變其「標籤」被首先顯示結果:<?php $tab = $_GET['tab']; ?>
「標籤」將是數字1,2,3或4.即。選項卡1,選項卡2等...所以我如何使用這個PHP變量與jQuery來選擇哪個選項卡使活動?
感謝
你怎麼讓它活躍在JS(讓我們假設你沒有PHP的所有)? – zerkms 2010-12-20 23:49:01
那麼它只是選擇第一個李,就像上面說的那樣。但我想改變,取決於數字 – benhowdle89 2010-12-20 23:49:38