This commit is contained in:
joyqi 2022-04-02 18:10:28 +08:00
parent 004db7c056
commit 7ebfe82de1
3 changed files with 16 additions and 2 deletions

View File

@ -91,6 +91,7 @@
$('#typecho-nav-list ul.root').each(function () {
const ul = $(this), nav = ul.parent();
let focused = false;
ul.on('click touchend', '.parent a', function (e) {
nav.removeClass('noexpanded').addClass('expanded');
@ -102,6 +103,19 @@
nav.removeClass('expanded').addClass('noexpanded');
return false;
}));
$('a', ul).focus(function () {
ul.addClass('expanded');
focused = true;
}).blur(function () {
focused = false;
setTimeout(function () {
if (!focused) {
ul.removeClass('expanded');
}
});
});
});
if ($('.typecho-login').length == 0) {

View File

@ -170,7 +170,7 @@ select { border: 1px solid #CCC; height: 28px; }
.typecho-head-nav #typecho-nav-list > ul.focus .parent a { font-weight: bold; }
.typecho-head-nav #typecho-nav-list > ul.root:hover .child { display: block; }
.typecho-head-nav #typecho-nav-list > ul.root:hover .child, .typecho-head-nav #typecho-nav-list > ul.root.expanded .child { display: block; }
.typecho-head-nav .operate { float: right; }

View File

@ -100,7 +100,7 @@ $color-nav-child-focus: #6DA1BB;
font-weight: bold;
}
&.root:hover .child {
&.root:hover .child, &.root.expanded .child {
display: block;
}
}