Commit 6ceb0909 by naan1993

增加菜单点击高亮不会消失的效果

parent f74f3b56
...@@ -169,6 +169,7 @@ $(function () { ...@@ -169,6 +169,7 @@ $(function () {
if ($(this).parents('.J_menuTab').next('.J_menuTab').size()) { if ($(this).parents('.J_menuTab').next('.J_menuTab').size()) {
var activeId = $(this).parents('.J_menuTab').next('.J_menuTab:eq(0)').data('id'); var activeId = $(this).parents('.J_menuTab').next('.J_menuTab:eq(0)').data('id');
highLightMenuItem(activeId); //高亮对应的tab菜单
$(this).parents('.J_menuTab').next('.J_menuTab:eq(0)').addClass('active'); $(this).parents('.J_menuTab').next('.J_menuTab:eq(0)').addClass('active');
$('.J_mainContent .J_iframe').each(function () { $('.J_mainContent .J_iframe').each(function () {
...@@ -218,6 +219,7 @@ $(function () { ...@@ -218,6 +219,7 @@ $(function () {
return false; return false;
} }
}); });
highLightMenuItem(activeId);//高亮对应的tab菜单
} }
} }
// 当前元素不处于活动状态 // 当前元素不处于活动状态
...@@ -260,6 +262,7 @@ $(function () { ...@@ -260,6 +262,7 @@ $(function () {
function activeTab() { function activeTab() {
if (!$(this).hasClass('active')) { if (!$(this).hasClass('active')) {
var currentId = $(this).data('id'); var currentId = $(this).data('id');
highLightMenuItem(currentId); //高亮对应的tab菜单
// 显示tab对应的内容区 // 显示tab对应的内容区
$('.J_mainContent .J_iframe').each(function () { $('.J_mainContent .J_iframe').each(function () {
if ($(this).data('id') == currentId) { if ($(this).data('id') == currentId) {
......
...@@ -122,6 +122,11 @@ function clearTabMenuItem(){ ...@@ -122,6 +122,11 @@ function clearTabMenuItem(){
}); });
} }
function highLightMenuItem(hrefVal){
clearTabMenuItem();
$("a[href='" + hrefVal + "']").addClass("tab-menu-selected");
}
function NavToggle() { function NavToggle() {
$('.navbar-minimalize').trigger('click'); $('.navbar-minimalize').trigger('click');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment