fix: sidebar

This commit is contained in:
shenyu 2020-01-23 14:13:24 +08:00
parent 0fb41a4ce2
commit 8f267514b3
3 changed files with 1 additions and 21 deletions

View File

@ -9,11 +9,7 @@
<%- partial('_partial/totop') %>
</div>
</main>
<% if (theme.toc && is_post()){ %>
<aside class="sidebar">
<% } else { %>
<aside class="sidebar">
<% } %>
<%- partial('_partial/sidebar') %>
</aside>
<%- partial('_partial/modal') %>

BIN
source/images/ayer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -176,30 +176,14 @@
// Mobile nav
var $content = $('.content'),
$sidebar = $('.sidebar'),
isMobileNavAnim = false,
mobileNavAnimDuration = 200;
var startMobileNavAnim = function () {
isMobileNavAnim = true;
};
var stopMobileNavAnim = function () {
setTimeout(function () {
isMobileNavAnim = false;
}, mobileNavAnimDuration);
};
$sidebar = $('.sidebar');
$('.navbar-toggle').on('click', function () {
if (isMobileNavAnim) return;
startMobileNavAnim();
$content.toggleClass('on');
$sidebar.toggleClass('on');
stopMobileNavAnim();
});
$($content).on('click', function () {
if (isMobileNavAnim || !$content.hasClass('on')) return;
$content.removeClass('on');
$sidebar.removeClass('on');
});