當我點擊一個父菜單(如Domains)時,它會顯示它的子項,當我點擊其中的一個(比如My Domains)時,頁面會在父菜單關閉時重新加載(不擴展作爲圖像波紋管)點擊活動菜單上的類
的類是「主動」的菜單激活(藍色背景)和「打開」可見孩子
這些都是JS代碼:
// Handle clicking on the naviagtion dropdown items
jQuery('.navbar .toggle > a').click(function() {
if (!jQuery(this).next().is(":visible")) {
jQuery('.toggle a').removeClass('open');
jQuery('.toggle ul:visible').hide();
}
jQuery(this).toggleClass('open');
jQuery(this).next().slideToggle();
});
// Tabs Changer
// ===============================
//Default Action
jQuery(".tab-content").hide(); //Hide all content
if (jQuery(location).attr('hash').substr(1)!="") {
var activeTab = jQuery(location).attr('hash');
jQuery("ul").find('li').removeClass('open');
jQuery("ul.nav li").removeClass("active"); //Remove any "active" class
jQuery(activeTab+"nav").addClass("active");
jQuery(activeTab).show();
} else {
jQuery("#tabs ul.nav .nav-tabs li:first").addClass("active").show(); //Activate first tab
jQuery(".tab-content:first").show(); //Show first tab content
}
//On Click Event
jQuery("#tabs ul.nav li").click(function() {
jQuery("ul").find('li').removeClass('open');
jQuery("ul.nav li").removeClass("active"); //Remove any "active" class
jQuery(this).addClass("active"); //Add "active" class to selected tab
var activeTab = jQuery(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
if (activeTab.substr(0,1)=="#" && activeTab.substr(1)!="") { //Determine if a tab or link
jQuery(".tab-content").hide(); //Hide all tab content
jQuery(activeTab).fadeIn(); //Fade in the active content
return false;
} else {
return true; // If link allow redirect
}
});
});
點擊登錄看到菜單的活生生的例子: https://whmcsdesigns.com/demo/clientarea.php?action=domains
它完美的作品Shea!謝謝!!! –
不客氣:) – Shea