Skip to content

Commit 722839a

Browse files
author
Jordan McCullough
committed
Merge pull request #267 from github/curriculum-toc-default-on
Curriculum toc default on (continued)
2 parents 06a7cf8 + 3758150 commit 722839a

File tree

3 files changed

+10
-47
lines changed

3 files changed

+10
-47
lines changed

_javascript/curriculum.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,14 @@ $(function(){
100100
}
101101

102102
// Bind checkbox toggle for TOC
103-
$(".toc-toggle-check").change(function(){
104-
console.log("shiftleft on both.");
105-
$(".col-content").toggleClass("shift-left");
106-
$(".col-toc").toggleClass("shift-left");
107-
});
103+
var toc = {};
104+
toc.toggle = function(event){
105+
if(event.shiftKey && event.keyCode === 84){
106+
$(".col-content").toggleClass("shift-left");
107+
$(".col-toc").toggleClass("shift-left");
108+
}
109+
}
110+
document.addEventListener("keydown", toc.toggle, false);
108111

109112
// Render the TOC
110113
buildToc();

_layouts/curriculum.html

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@
1818
</div>
1919
</div>
2020

21-
22-
<div id="toc-toggle">
23-
<input type="checkbox" class="toc-toggle-check" id="toc-toggle-check" name="toc-toggle-check" value="true" checked="checked">
24-
<label class="toc-toggle-label" for="toc-toggle-check">
25-
<span class="octicon octicon-list-unordered"></span>
26-
<!-- <span class="toc-header">Table of Contents</span> -->
27-
</label>
28-
</div>
29-
3021
<div class="col-content deck col-md-12 col-sm-12 col-xs-12 materials curriculum shift-left">
3122
<div id="teacher" class="hidden">
3223
<div class="alignment">
@@ -74,6 +65,7 @@
7465
<div class="col-toc col-md-2 col-sm-2 col-xs-2 shift-left">
7566
<div id="toc-wrapper">
7667
<div id="toc" data-spy="affix" data-offset-top="145">
68+
<h4>Table of Contents</h4>
7769
<ul id="toc-list" class="nav nav-pills nav-stacked" role="tablist">
7870
<li></li>
7971
</ul>

_stylesheets/curriculum.scss

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,38 +42,6 @@ table{
4242
}
4343
}
4444

45-
#toc-toggle{
46-
position: fixed;
47-
top: 15px;
48-
right: 24px;
49-
padding: 0;
50-
margin: 0;
51-
z-index:1000;
52-
}
53-
.toc-toggle-check{
54-
visibility: hidden;
55-
width: 0;
56-
height: 0;
57-
58-
& + .toc-toggle-label{
59-
color: $gray-darker;
60-
opacity: .3;
61-
62-
.toc-header{
63-
margin-left: 1em;
64-
display: none;
65-
}
66-
}
67-
68-
&:checked + .toc-toggle-label{
69-
opacity: 1;
70-
// right: 16.66667%;
71-
72-
.toc-header{
73-
display: inline;
74-
}
75-
}
76-
}
7745

7846
#toc-wrapper{
7947
opacity: .5;
@@ -361,7 +329,7 @@ table{
361329
}
362330

363331
.affix{
364-
margin-top: -130px;
332+
margin-top: -165px;
365333
position: fixed;
366334
}
367335

0 commit comments

Comments
 (0)