Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb670b72

Browse files
committed
improve
1 parent0a2c552 commitb670b72

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

‎python_docs_theme/layout.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ <h3>{{ _('Navigation') }}</h3>
7878
<scripttype="text/javascript"src="{{ pathto('_static/menu.js', 1) }}"></script>
7979
<scripttype="text/javascript"src="{{ pathto('_static/search-focus.js', 1) }}"></script>
8080
<scripttype="text/javascript"src="{{ pathto('_static/themetoggle.js', 1) }}"></script>
81+
<scripttype="text/javascript"src="{{ pathto('_static/sidebar-resizer.js', 1) }}"></script>
8182
{%- endif -%}
8283
{%- endif -%}
8384
{{ super() }}

‎python_docs_theme/static/pydoctheme.css

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
@importurl('classic.css');
22

3+
/* Smooth scroll */
4+
html {
5+
scroll-behavior: smooth;
6+
}
7+
38
/* Common colours */
49
:root {
510
--good-color:rgb(4110051);
@@ -129,6 +134,7 @@ form.inline-search input[type='submit'] {
129134
}
130135

131136
div.document {
137+
animation: fadeIn0.6s ease-in-out;
132138
display: flex;
133139
/* Don't let long code literals extend beyond the right side of the screen */
134140
overflow-wrap: break-word;
@@ -149,11 +155,7 @@ div.sphinxsidebar {
149155
border-radius:5px;
150156
line-height:130%;
151157
font-size: smaller;
152-
width:300px;
153-
min-width:200px;
154-
max-width:500px;
155-
resize: horizontal;
156-
overflow: auto;
158+
transition: width0.3s ease;
157159
}
158160

159161
div.sphinxsidebarh3,
@@ -162,7 +164,7 @@ div.sphinxsidebar h4 {
162164
}
163165

164166
div.sphinxsidebarwrapper {
165-
width:300px;
167+
width:217px;
166168
box-sizing: border-box;
167169
height:100%;
168170
overflow-x: hidden;
@@ -210,6 +212,9 @@ div.sphinxsidebar input[type='text'] {
210212
width:12px;
211213
border-radius:05px5px0;
212214
border-left: none;
215+
position: absolute;
216+
right:0;
217+
transition: background-color0.3s ease, color0.3s ease;
213218
}
214219

215220
#sidebarbuttonspan {
@@ -766,3 +771,13 @@ div.versionremoved .versionmodified {
766771
display: none;
767772
}
768773
}
774+
775+
/* Animation */
776+
@keyframes fadeIn {
777+
from {
778+
opacity:0;
779+
}
780+
to {
781+
opacity:1;
782+
}
783+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
document.addEventListener('DOMContentLoaded',function(){
2+
constsidebar=document.querySelector('.sphinxsidebar');
3+
constresizer=document.createElement('div');
4+
resizer.className='sidebar-resizer';
5+
sidebar.appendChild(resizer);
6+
7+
resizer.addEventListener('mousedown',function(e){
8+
document.addEventListener('mousemove',resizeSidebar);
9+
document.addEventListener('mouseup',stopResize);
10+
});
11+
12+
functionresizeSidebar(e){
13+
constnewWidth=e.clientX-sidebar.getBoundingClientRect().left;
14+
if(newWidth>150&&newWidth<window.innerWidth-100){
15+
sidebar.style.width=newWidth+'px';
16+
}
17+
}
18+
19+
functionstopResize(){
20+
document.removeEventListener('mousemove',resizeSidebar);
21+
document.removeEventListener('mouseup',stopResize);
22+
}
23+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp