新增文档页面作者悬浮修改按钮

This commit is contained in:
yangjian 2020-11-21 21:27:53 +08:00
parent 050782ef66
commit 9f4236ecd9
3 changed files with 11 additions and 39 deletions

View File

@ -374,7 +374,7 @@ li.active > a,li.active > div > a{
}
/* 返回顶部 */
.toTop {
.toTop,.tocMenu,.shareDoc,.editDoc{
width: 40px;
height: 40px;
border-radius: 50%;
@ -389,28 +389,7 @@ li.active > a,li.active > div > a{
font-size: 12px; */
}
.toTop:hover {
background: #eeeeee;
font-size: 14px;
cursor: pointer;
color: red;
}
/* 文档目录 */
.tocMenu{
width: 40px;
height: 40px;
border-radius: 50%;
background: #f6f6f6;
text-align: center;
line-height: 40px;
/*返回顶部标签固定定位*/
/* position: fixed;
right: 35px;
bottom: 90px;
z-index: 999;
font-size: 12px; */
}
.tocMenu:hover,.shareDoc:hover {
.toTop:hover,.tocMenu:hover,.shareDoc:hover,.editDoc:hover {
background: #eeeeee;
font-size: 14px;
cursor: pointer;
@ -419,21 +398,7 @@ li.active > a,li.active > div > a{
.doc-toc-hide{
display: none;
}
/* 分享按钮 */
.shareDoc{
width: 40px;
height: 40px;
border-radius: 50%;
background: #f6f6f6;
text-align: center;
line-height: 40px;
/*返回顶部标签固定定位*/
/* position: fixed;
right: 35px;
bottom: 135px;
z-index: 999;
font-size: 14px; */
}
/*切换字号*/
.switch-font{

View File

@ -97,11 +97,15 @@
{% endblock %}
{% block right_widget %}
<!-- 修改文档 -->
{% if doc.create_user == request.user %}
<a class="editDoc" href="{% url 'modify_doc' doc_id=doc.id %}" title="修改文档"><i class="fa fa-pencil"></i></a>
{% endif %}
<!-- 目录 -->
<div class="tocMenu" style="display: none;"><i class="fa fa-list"></i></div>
<!-- 分享按钮 -->
{% if project.role == 1 and request.user == doc.create_user %}
<div class="shareDoc" id="shareDoc" ><i class="fa fa-share"></i></div>
<div class="shareDoc" id="shareDoc"><i class="fa fa-share"></i></div>
{% endif %}
{% endblock %}

View File

@ -560,12 +560,15 @@
$(document).ready(function() {
// 初始时,“返回顶部”标签隐藏
$(".toTop").hide();
$(".editDoc").hide();
$(window).scroll(function() {
// 若滚动的高度,超出指定的高度后,“返回顶部”的标签出现。
if($(document).scrollTop() >= 140) {
$(".toTop").show();
$(".editDoc").show();
} else {
$(".toTop").hide();
$(".editDoc").hide();
}
})
// 绑定点击事件,实现返回顶部的效果