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