hexo-theme-keep/layout/common/nav.ejs

27 lines
1.1 KiB
Plaintext

<script>
let isOpenLeftSide = true;
const foldLeftSide = () => {
document.querySelector('.page-left').style.display = isOpenLeftSide ? 'none' : 'block';
document.querySelector('.page-right').style.width = isOpenLeftSide ? '100%' : '<%= theme.page.right_side_width + '%' %>';
isOpenLeftSide = !isOpenLeftSide;
};
</script>
<nav class="nav">
<button class="fold-left-side-btn"
onclick="foldLeftSide()"
>
<i class="fa fa-bars"></i>
</button>
<ul class="menu-list">
<% for (let i in theme.menu) { %>
<li class="menu-item">
<a class="<%- isInHomePaging(page.path, theme.menu[i]) ? 'current' : is_current(theme.menu[i]) ? 'current' : '' %>"
href="<%- url_for(theme.menu[i]) %>"><%= __(i.toLowerCase()) %></a>
</li>
<% } %>
</ul>
<% if (theme.local_search.enable) { %>
<button class="search-btn btn popup-trigger"><i class="fa fa-search"></i> <%= __('search') %></button>
<%- next_js('local-search.js') %>
<% } %>
</nav>