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

27 lines
1.0 KiB
Plaintext
Raw Normal View History

2020-03-22 20:31:13 +08:00
<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">
2020-03-22 20:31:13 +08:00
<button class="fold-left-side-btn"
onclick="foldLeftSide()"
>
<i class="fa fa-bars"></i>
2020-03-22 20:31:13 +08:00
</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></button>
<%- next_js('local-search.js') %>
<% } %>
</nav>