Skip to content

Commit 44f17b0

Browse files
committed
Merge pull request scikit-learn#4663 from Titan-C/sidebar
[MRG + 1] Sidebar hide in css
2 parents 6eee7a5 + 1095e7e commit 44f17b0

File tree

4 files changed

+71
-171
lines changed

4 files changed

+71
-171
lines changed

doc/themes/scikit-learn/layout.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Layout for scikit-learn, after a design made by Angel Soler
66
(http://angelsoler.net)
77

8-
Update: Collapsable sidebar added - 13/03/2012 - Jaques Grobler
98
Update: Next-page button added - 16/03/2012 - Jaques Grobler
109

1110

@@ -25,9 +24,6 @@
2524

2625
{% block extrahead %}
2726
{% if pagename != 'index' %}
28-
{% if theme_collapsiblesidebar|tobool %}
29-
<script type="text/javascript" src="{{ pathto('_static/sidebar.js', 1) }}"></script>
30-
{% endif %}
3127
{% endif %}
3228
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
3329
<script src="{{ pathto('_static/js/bootstrap.min.js', 1)}}" type="text/javascript"></script>
@@ -42,9 +38,6 @@
4238
$(this).css('background-color', '#A7D6E2');
4339
}
4440
);
45-
var bodywrapper = $('.bodywrapper');
46-
var sidebarbutton = $('#sidebarbutton');
47-
sidebarbutton.css({'height': '900px'});
4841
</script>
4942
{% endblock %}
5043

@@ -276,6 +269,10 @@ <h2>Machine Learning in Python</h2>
276269
{{ toc }}
277270
</div>
278271
</div>
272+
{% if theme_collapsiblesidebar|tobool %}
273+
<input type="checkbox" id="nav-trigger" class="nav-trigger" checked />
274+
<label for="nav-trigger"></label>
275+
{% endif %}
279276
{% endif %}
280277

281278

doc/themes/scikit-learn/static/nature.css_t

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ div.content-wrapper {
142142
}
143143

144144
div.content {
145-
margin-left: 210px;
146-
padding-bottom: 10px;
145+
z-index: 1;
146+
position: relative;
147+
background-color: #FFF;
148+
padding-left: 15px;
147149
}
148150

149151
div.example_digits {
@@ -254,6 +256,7 @@ div.sphinxsidebar {
254256
border-left-width: 0;
255257
border-bottom-width: 0;
256258
margin-top: 0;
259+
position: absolute;
257260
}
258261

259262
div.sphinxsidebar h3 {
@@ -277,9 +280,45 @@ div.sphinxsidebarwrapper {
277280

278281
{% if theme_collapsiblesidebar|tobool %}
279282
/* for collapsible sidebar */
280-
div#sidebarbutton {
283+
.nav-trigger {
284+
position: fixed;
285+
clip: rect(0, 0, 0, 0);
286+
}
287+
288+
.nav-trigger + label:after {
289+
content: '»';
290+
}
291+
292+
label[for="nav-trigger"] {
293+
position: fixed;
294+
margin-left: 0px;
295+
padding-top: 100px;
296+
z-index: 2;
297+
width: 15px;
298+
height: 80%;
299+
cursor: pointer;
300+
background-size: contain;
281301
background-color: #F6F6F6;
282-
position: relative;
302+
border-radius: 10px 0px 0px 10px;
303+
}
304+
305+
label[for="nav-trigger"]:hover {
306+
background-color: #D0D0D0;
307+
}
308+
309+
.nav-trigger:checked + label {
310+
margin-left: 200px;
311+
}
312+
313+
.nav-trigger:checked + label:after {
314+
content: '«';
315+
}
316+
317+
.nav-trigger:checked ~ div.content {
318+
margin-left: 200px;
319+
}
320+
.nav-trigger + label, div.content {
321+
transition: left 0.4s;
283322
}
284323
{% endif %}
285324

@@ -1164,6 +1203,29 @@ div.container-index {
11641203
display: none;
11651204
}
11661205

1206+
1207+
{% if theme_collapsiblesidebar|tobool %}
1208+
div.content {
1209+
margin-left: 200px;
1210+
}
1211+
.nav-trigger + label:after {
1212+
content: '«';
1213+
}
1214+
label[for="nav-trigger"] {
1215+
margin-left: 200px;
1216+
}
1217+
1218+
.nav-trigger:checked + label {
1219+
margin-left: 0px;
1220+
}
1221+
.nav-trigger:checked + label:after {
1222+
content: '»';
1223+
}
1224+
.nav-trigger:checked ~ div.content {
1225+
margin-left: 0px;
1226+
}
1227+
1228+
{%- else %}
11671229
.sphinxsidebar {
11681230
display: none;
11691231
}
@@ -1172,6 +1234,7 @@ div.container-index {
11721234
margin-left: 0;
11731235
}
11741236

1237+
{% endif %}
11751238

11761239
div.container-index {
11771240
margin-left: 0;

doc/themes/scikit-learn/static/sidebar.js

Lines changed: 0 additions & 156 deletions
This file was deleted.

doc/tune_toc.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
(!$(this).children('ul').is(':hidden')) ? '\u25ba' : '\u25bc');
1212
$(this).children('ul').toggle();
1313
}
14-
// Update the sidebar height when expanding/collapsing toctree elemements
15-
$('#sidebarbutton').animate({height : $('.toctree-wrapper').height() + 50}, 0);
1614
return true; //Makes links clickable
1715
}
1816
})
@@ -22,8 +20,6 @@
2220
$('li.toctree-l2:not(:has(ul))').attr('data-content', '-');
2321
$('li.toctree-l2:has(ul)').attr('data-content', '\u25ba');
2422
$('li.toctree-l2:has(ul)').css('cursor', 'pointer');
25-
//Initialise the sidebar button with the collapsing toctree
26-
$('#sidebarbutton').animate({height : $('.toctree-wrapper').height() + 50}, 0);
2723
2824
$('.toctree-l2').hover(
2925
function () {

0 commit comments

Comments
 (0)