Skip to content

Commit

Permalink
Fix wrong sidebar style on mobile (#808)
Browse files Browse the repository at this point in the history
* Fix #807

* Add `$b2t-opacity-hover` & Remove hover highlight
  • Loading branch information
stevenjoezhang authored Apr 4, 2019
1 parent e35d73c commit 8ed5d6e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions source/css/_common/components/back-to-top-sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
opacity: $b2t-opacity;
cursor: pointer;
text-align: center;
&:hover { opacity: 0.8; }
&:hover { opacity: $b2t-opacity-hover; }

+tablet-mobile() {
hexo-config('sidebar.onmobile') ? fixbutton() : hide();
hide() if not hexo-config('sidebar.onmobile');
}

&.back-to-top-on {
Expand Down
5 changes: 3 additions & 2 deletions source/css/_common/components/back-to-top.styl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
&.back-to-top-on {
bottom: $b2t-position-bottom-on;
}
&:hover {
color: $sidebar-highlight;
+tablet-mobile() {
opacity: $b2t-opacity-hover;
right: $b2t-position-right-mobile;
}
}
7 changes: 3 additions & 4 deletions source/css/_common/components/sidebar/sidebar-toggle.styl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
.sidebar-toggle {
&:hover .sidebar-toggle-line {
background: $sidebar-highlight;
}
position: fixed;
right: $b2t-position-right;
bottom: 45px;
Expand All @@ -14,7 +11,9 @@
cursor: pointer;

+tablet-mobile() {
hexo-config('sidebar.onmobile') ? fixbutton() : hide();
opacity: $b2t-opacity-hover;
right: $b2t-position-right-mobile;
hide() if not hexo-config('sidebar.onmobile');
}
}

Expand Down
5 changes: 0 additions & 5 deletions source/css/_mixins/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ show() {
display: block;
}

fixbutton() {
right: 20px;
opacity: 0.8;
}

random-color($min, $max) {
return floor(math(0, 'random') * ($max - $min + 1) + $min);
}
Expand Down
2 changes: 2 additions & 0 deletions source/css/_variables/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,11 @@ $toc-link-active-current-border-color = $sidebar-highlight
// --------------------------------------------------
// Back to top
$b2t-opacity = 1
$b2t-opacity-hover = 0.8
$b2t-position-bottom = -100px
$b2t-position-bottom-on = 19px
$b2t-position-right = 30px
$b2t-position-right-mobile = 20px
$b2t-font-size = 12px
$b2t-color = white
$b2t-bg-color = $black-deep
Expand Down

0 comments on commit 8ed5d6e

Please sign in to comment.