Skip to content

Commit

Permalink
⚡ 优化侧边栏的滚动
Browse files Browse the repository at this point in the history
  • Loading branch information
zkqiang committed Feb 9, 2022
1 parent 3311abe commit 4a7294b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 24 deletions.
4 changes: 2 additions & 2 deletions layout/post.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha

<div class="container-fluid nopadding-x">
<div class="row nomargin-x">
<div class="d-none d-lg-block col-lg-2">
<div class="side-col d-none d-lg-block col-lg-2">
<%- inject_point('postLeft') %>
</div>

Expand Down Expand Up @@ -78,7 +78,7 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha
</div>
</div>

<div class="d-none d-lg-block col-lg-2">
<div class="side-col d-none d-lg-block col-lg-2">
<%- inject_point('postRight') %>
</div>
</div>
Expand Down
4 changes: 0 additions & 4 deletions source/css/_pages/_base/_widget/category_bar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
height 100%

.category-list
position -webkit-sticky
position sticky
top 2rem
padding 3rem 0 0 0
max-height 85vh
overflow-y auto
overflow-x hidden
Expand Down
13 changes: 3 additions & 10 deletions source/css/_pages/_base/_widget/toc.styl
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#toc
position -webkit-sticky
position sticky
top 2rem
padding 3rem 0 0 0
visibility hidden

.toc-header
Expand Down Expand Up @@ -69,9 +65,6 @@
transition height .1s ease-in-out, margin .1s ease-in-out, visibility .1s ease-in-out

.sidebar
height 100%

@media (max-width: 1024px)
.sidebar
padding-left 0
padding-right 0
position sticky
top 2rem
padding 3rem 0
16 changes: 8 additions & 8 deletions source/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ Fluid.events = {
return;
}
var parallax = function() {
var oVal = jQuery(window).scrollTop() / 5;
var pxv = jQuery(window).scrollTop() / 5;
var offset = parseInt(board.css('margin-top'), 10);
var max = 96 + offset;
if (oVal > max) {
oVal = max;
if (pxv > max) {
pxv = max;
}
ph.css({
transform: 'translate3d(0,' + oVal + 'px,0)'
transform: 'translate3d(0,' + pxv + 'px,0)'
});
var sidebar = jQuery('.sidebar');
if (sidebar) {
sidebar.css({
'padding-top': oVal + 'px'
var sideCol = jQuery('.side-col');
if (sideCol) {
sideCol.css({
'padding-top': pxv + 'px'
});
}
};
Expand Down

0 comments on commit 4a7294b

Please sign in to comment.