我正在致力於clients site,它有一個側邊欄菜單,其中包含產品類別和產品作爲產品類別的子菜單。問題在於,我已將其切換,因此如果您點擊產品類別,則會打開子菜單,如果再次點擊,則會關閉。現在,如果我點擊子菜單上的產品,我會進入產品頁面,但我需要它也顯示處於打開狀態的子菜單。WordPress&jQuery子菜單
到目前爲止的代碼是...
$("#sidebar ul li a").click(function(e){
if($(this).parent().children('ul').length > 0){
e.preventDefault(); //prevent the link from being followed
$(this).parent().find('ul').toggle('100');
}
});
現在,我希望它有像...
if($("#sidebar .current_page_item") (<< has two ULS, meaning it's a submenu >>)
$(this). (<< some code to make the submenu display:block >>)
}
但是我不知道是什麼,所以有史以來如何做到這一點,任何幫助將不勝感激。
甚至不知道那件事,做了一些研究並糾正了自己。感謝您的高舉。 – CodeInACan