0
使用此處提供的解決方案How to highlight active page in a masterpage menu?我能夠讓我的活動菜單項在導航菜單上正確顯示。我正在使用VB.NET和一個主頁面。下面的代碼駐留在母版:突出顯示活動菜單選項
<script>
function equalHeight(group) {
tallest = 0;
group.each(function() {
thisHeight = $(this).height();
if (thisHeight > tallest) {
tallest = thisHeight;
}
});
group.each(function() { $(this).height(tallest); });
}
jQuery(document).ready(function() {
App.init();
// Call to set active menu selecttion
var str = location.href.toLowerCase();
$(".nav li a").each(function() {
if (str.indexOf($(this).attr("href").toLowerCase()) > -1) {
$("li.active").removeClass("active");
$(this).parent().addClass("active");
}
});
equalHeight($(".img-thumbnail"));
});
</script>
新增:如果一個節(「工具」爲實例)有下它屬於多頁,你能想到的任何方式都在上面的代碼選擇正確的活躍菜單項?