confluence文檔添加右側浮動導航


confluence文檔添加右側浮動導航

confluence默認toc目錄是插入到文檔的固定位置的,很不方便。
所以我們通過幾行代碼讓它能夠右側浮動顯示。

首先需要插入目錄宏,
然后插入html宏,在里面添加如下內容:

<div id='my_toc' style="border:1px solid black;width: 350px;height:600px; overflow:auto; position: fixed; bottom: 20px;right: 25px; z-index: 100; background:url(http://sandbox.runjs.cn/uploads/rs/424/omg6xh6h/o_body_bg_new.jpg);"> </div>

<!-- <input type='button' id="btn1" value='把div1內容插入到div2' onclick='mv_div()'/> -->
  <div style="border:1px solid black;width: 70px;height:30px;  position: fixed; bottom: 20px;right: 25px; z-index: 110; text-align:center;line-height:30px; background-color:white;"  onclick="toggle_toc()">
隱藏/顯示
 </div>
<script>
function mv_div(){
    var html = $('.toc-macro');
    $('#my_toc').append(html);
};
$(mv_div)


function toggle_toc(){
  if($("#my_toc").is(":hidden")){
       $("#my_toc").show();    //如果元素為隱藏,則將它顯現
  }else{
      $("#my_toc").hide();     //如果元素為顯現,則將其隱藏
  }
}
</script>

保存,ok。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM