fix(core): fixed home menu auto nav issue

This commit is contained in:
OldHawk
2018-05-18 20:04:39 +08:00
parent 96e2ed3b8c
commit 4d53a851c5
3 changed files with 34 additions and 20 deletions

View File

@@ -45,31 +45,45 @@
$('.popup_wrapper').remove();
}
});
//set menu bar opened when hover
$('div.navbar-mt ul.nav li.dropdown').hover(function (evt) {
if (!$(this).hasClass('open')) {
$(this).find('.dropdown-toggle', this).trigger('click');
$(this).bind('click', function (e) {
var sta = $(this).find('.dropdown-toggle', this).attr('alt');
if (sta)
$state.go(sta);
});
}
}, function (evt) {
$(this).unbind('click');
if ($(this).hasClass('open')) {
$(this).find('.dropdown-toggle', this).trigger('click');
}
});
});
/**
* bindHoverToMenuItem
*/
vm.bindHoverToMenuItem = function () {
//set menu bar opened when hover
$timeout(function () {
$('div.navbar-mt ul.nav li.dropdown').off('mouseenter mouseleave').hover(function (evt) {
if (!$(this).hasClass('open')) {
$(this).find('.dropdown-toggle', this).trigger('click');
$(this).off('click').on('click', function (e) {
var sta = $(this).find('.dropdown-toggle', this).attr('alt');
if (sta) {
$state.go(sta);
}
});
}
}, function (evt) {
$(this).off('click');
if ($(this).hasClass('open')) {
$(this).find('.dropdown-toggle', this).trigger('click');
}
});
$('div.navbar-mt ul.nav li.dropdown ul.dropdown-menu').off('mouseenter mouseleave').hover(function (evt) {
$(this).parent().off('click');
}, function (evt) {
});
}, 0);
};
/**
* auth-user-changed
*/
$scope.$on('auth-user-changed', function (event, args) {
vm.user = Authentication.user;
vm.scoreLevelData = vm.user ? ScoreLevelService.getScoreLevelJson(vm.user.score) : undefined;
vm.bindHoverToMenuItem();
vm.getInvitationsCount();
vm.getWarning();
vm.getCountUnread();