blob: 72b8e7ee314dd98b93de999c65dda7ff556eb49d [file] [log] [blame]
commit 645f1e7bff98e6c755c7a14a43e0a623f321d35f
Author: davidChan3000 <chengdawei3000@163.com>
Date: Thu Jun 16 18:14:24 2022 +0800
feat: optimize left menu usage (#2094)
diff --git a/docs/static/css/theme-white.css b/docs/static/css/theme-white.css
index bb7d903fa..cb255e6ad 100644
--- a/docs/static/css/theme-white.css
+++ b/docs/static/css/theme-white.css
@@ -64,6 +64,10 @@ header .select-style select{
z-index: 2;
}
+#sidebar .leftMenu{
+ overflow-y: auto;
+}
+
#header-wrapper{
position:sticky;
background-color: #fff;
@@ -457,6 +461,7 @@ table td,p,code{
left:-300px;
width: 300px;
padding-left: 16px;
+ background-color: #fff;
}
.sidebar-hidden #body{
@@ -474,6 +479,22 @@ table td,p,code{
}
.icon-3,.icon-2,.icon-1{display: none;}
+ .retro-theme #sidebar{
+ background-color: #F2EFDD;
+ }
+ .eyehelp-theme #sidebar{
+ background-color: #C7EBC9;
+ }
+ .haitian-theme #sidebar{
+ background-color: #E5EDFF;
+ }
+ .deep-theme #sidebar{
+ background-color: #15202F;
+ }
+ .dark-theme #sidebar{
+ background-color: #171717;
+ }
+
}
@keyframes mymove {
diff --git a/docs/themes/hugo-theme-learn/layouts/partials/menu.html b/docs/themes/hugo-theme-learn/layouts/partials/menu.html
index 79d2badd6..4341544b5 100644
--- a/docs/themes/hugo-theme-learn/layouts/partials/menu.html
+++ b/docs/themes/hugo-theme-learn/layouts/partials/menu.html
@@ -12,6 +12,7 @@
</div>
<div class="highlightable">
+ <div class="leftMenu">
<ul class="topics">
{{if eq .Site.Params.ordersectionsby "title"}}
@@ -38,7 +39,7 @@
</ul>
</section>
{{end}}
-
+ </div>
<!-- {{ if or .Site.IsMultiLingual $showvisitedlinks }}
<section id="prefooter">
<hr/>
diff --git a/docs/themes/hugo-theme-learn/static/js/learn.js b/docs/themes/hugo-theme-learn/static/js/learn.js
index 976300675..7a7401117 100644
--- a/docs/themes/hugo-theme-learn/static/js/learn.js
+++ b/docs/themes/hugo-theme-learn/static/js/learn.js
@@ -26,8 +26,8 @@ function getScrollBarWidth() {
};
function setMenuHeight() {
- $('#sidebar .highlightable').height($('#sidebar').innerHeight() - $('#header-wrapper').height() - 40);
- $('#sidebar .highlightable').perfectScrollbar('update');
+ $('#sidebar .leftMenu').height($(window).innerHeight() - $('#header-wrapper').height() - 240);
+ $('#sidebar .leftMenu').perfectScrollbar('update');
}
function fallbackMessage(action) {
@@ -49,7 +49,7 @@ function fallbackMessage(action) {
// for the window resize
$(window).resize(function() {
- // setMenuHeight();
+ setMenuHeight();
});
// debouncing function from John Hann
@@ -91,7 +91,7 @@ jQuery(document).ready(function() {
var sidebarStatus = searchStatus = 'open';
$('#sidebar .highlightable').perfectScrollbar();
- // setMenuHeight();
+ setMenuHeight();
jQuery('#overlay').on('click', function() {
jQuery(document.body).toggleClass('sidebar-hidden');