Permalink
Browse files

feat: toc area 目录背景元素

Hide switch-btn and switch-area when toc is shown.
  • Loading branch information...
MOxFIVE committed Oct 5, 2015
1 parent f1edc64 commit 70b305e2c9313300d39def7dddf33f7e45b01c2e
Showing with 14 additions and 2 deletions.
  1. +2 −2 themes/Yilia/layout/_partial/left-col.ejs
  2. +12 −0 themes/Yilia/layout/_partial/toc.ejs
@@ -19,7 +19,7 @@
<input type="text" id="bdcsMain" class="search" placeholder=" Search..."></form>
<script type="text/javascript">(function(){document.write(unescape('%3Cdiv id="bdcs"%3E%3C/div%3E'));var bdcs = document.createElement('script');bdcs.type = 'text/javascript';bdcs.async = true;bdcs.src = 'http://znsv.baidu.com/customer_search/api/js?sid=18240140946075612580' + '&plate_url=' + encodeURIComponent(window.location.href) + '&t=' + Math.ceil(new Date()/3600000);var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(bdcs, s);})();</script>
<%if(theme.tagcloud){%>
<div class="switch-btn">
<div id="switch-btn" class="switch-btn">
<div class="icon">
<div class="icon-ctn">
<div class="icon-wrap icon-house" data-idx="0">
@@ -59,7 +59,7 @@
</div>
</div>
<%}%>
<div class="switch-area">
<div id="switch-area" class="switch-area">
<div class="switch-wrap">
<section class="switch-part switch-part1">
<nav class="header-menu">
View
@@ -4,6 +4,14 @@
<strong class="toc-title">文章目录</strong>
<%- toc(post.content) %>
</div>
<style type="text/css">
.left-col .switch-btn {
display: none;
}
.left-col .switch-area {
display: none;
}
</style>
<input type="button" id="tocButton" value="隐藏目录" title="点击按钮隐藏或者显示文章目录">
<script type="text/javascript">
@@ -15,10 +23,14 @@
if(toc_div.style.display=="none"){
toc_div.style.display="block";
toc_button.value="隐藏目录";
document.getElementById("switch-btn").style.display="none";
document.getElementById("switch-area").style.display="none";
}
else{
toc_div.style.display="none";
toc_button.value="显示目录";
document.getElementById("switch-btn").style.display="block";
document.getElementById("switch-area").style.display="block";
}
}
</script>

0 comments on commit 70b305e

Please sign in to comment.