Skip to content

Commit 8ed5d6e

Browse files
Fix wrong sidebar style on mobile (#808)
* Fix #807 * Add `$b2t-opacity-hover` & Remove hover highlight
1 parent e35d73c commit 8ed5d6e

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

source/css/_common/components/back-to-top-sidebar.styl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
opacity: $b2t-opacity;
77
cursor: pointer;
88
text-align: center;
9-
&:hover { opacity: 0.8; }
9+
&:hover { opacity: $b2t-opacity-hover; }
1010

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

1515
&.back-to-top-on {

source/css/_common/components/back-to-top.styl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
&.back-to-top-on {
1919
bottom: $b2t-position-bottom-on;
2020
}
21-
&:hover {
22-
color: $sidebar-highlight;
21+
+tablet-mobile() {
22+
opacity: $b2t-opacity-hover;
23+
right: $b2t-position-right-mobile;
2324
}
2425
}

source/css/_common/components/sidebar/sidebar-toggle.styl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
.sidebar-toggle {
2-
&:hover .sidebar-toggle-line {
3-
background: $sidebar-highlight;
4-
}
52
position: fixed;
63
right: $b2t-position-right;
74
bottom: 45px;
@@ -14,7 +11,9 @@
1411
cursor: pointer;
1512

1613
+tablet-mobile() {
17-
hexo-config('sidebar.onmobile') ? fixbutton() : hide();
14+
opacity: $b2t-opacity-hover;
15+
right: $b2t-position-right-mobile;
16+
hide() if not hexo-config('sidebar.onmobile');
1817
}
1918
}
2019

source/css/_mixins/base.styl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ show() {
7676
display: block;
7777
}
7878

79-
fixbutton() {
80-
right: 20px;
81-
opacity: 0.8;
82-
}
83-
8479
random-color($min, $max) {
8580
return floor(math(0, 'random') * ($max - $min + 1) + $min);
8681
}

source/css/_variables/base.styl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ $toc-link-active-current-border-color = $sidebar-highlight
279279
// --------------------------------------------------
280280
// Back to top
281281
$b2t-opacity = 1
282+
$b2t-opacity-hover = 0.8
282283
$b2t-position-bottom = -100px
283284
$b2t-position-bottom-on = 19px
284285
$b2t-position-right = 30px
286+
$b2t-position-right-mobile = 20px
285287
$b2t-font-size = 12px
286288
$b2t-color = white
287289
$b2t-bg-color = $black-deep

0 commit comments

Comments
 (0)