You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.8 KiB

<nav class="nav">
<div class="border">
<img src="<%- url_for('images/logo.png')%>" />
<button class="hiden-in-phone">V2.1</button>
<button id="btn-menu" class="hiden-in-pc">菜单</button>
<ul class="nav-link hiden-in-phone">
<!--li>
<form id="search-form">
<input type="text" id="search-query" class="search-query">
</form>
</li!-->
<li><a href="https://github.com/Tencent/xLua" class="nav-link-li<%- page.path.match(/download/) ? ' current' : '' %>">下载项目</a></li>
<li><a href="<%- url_for("/v1/guide/use.html") %>" class="nav-link-li<%- page.path.match(/use/) ? ' current' : '' %>">使用案例</a></li>
<li><a href="<%- url_for("/v1/guide/version.html") %>" class="nav-link-li<%- page.path.match(/version/) ? ' current' : '' %>">更新记录</a></li>
<li><a href="<%- url_for("/v1/guide/contribution.html") %>" class="nav-link-li<%- page.path.match(/contribution/) ? ' current' : '' %>">贡献指南</li>
<li><a href="<%- url_for("/v1/guide/index.html") %>" class="nav-link-li<%- page.path.match(/index/) ? ' current' : '' %>">教程</a></li>
<li><a href="<%- url_for("/") %>" class="nav-link-li<%- page.path.match(/\//) ? ' current' : '' %>">首页</a></li>
</ul>
</div>
</nav>
<div id="container" class="container clear">
<%- partial('partials/sidebar') %>
<%- partial('partials/article') %>
</div>
<footer>
<div>
<p><%- theme.copyright %></p>
<p><%- theme.copyright_desc %></p>
</div>
</footer>
<script>
var vm = new Vue({
el : '#container',
data: {
sub_nav : [ ]
},
created:function(){
var obj = [];
$("article h3").each(function(){
obj.push({name : $(this).find("a").attr("title") , href : "#"+$(this).attr("id") });
});
this.sub_nav = obj;
}
});
var isShow = false;
$("nav").on("click","#btn-menu" , function(){
if(!isShow){
if($(document).scrollTop() > $(".sidebar").height() - 100){
$('html, body').animate({scrollTop:0} , 300, "swing",function(){
$(".sidebar").fadeIn();
$(".container").animate({"left" : "15rem"}, 500,"swing");
});
}else{
$(".sidebar").fadeIn();
$(".container").animate({"left" : "15rem"}, 500,"swing");
}
}else{
$(".sidebar").fadeOut();
$(".container").animate({"left" : "0rem"}, 500,"swing");
}
isShow = !isShow;
});
$(".container").on("click" , "article" , function(){
if(isShow){
$(".sidebar").fadeOut();
$(".container").animate({"left" : "0rem"}, 500,"swing");
isShow = false;
}
});
</script>