File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,6 @@ $(function(){
19
19
proximity : 150
20
20
} ) ;
21
21
22
-
23
-
24
22
function buildToc ( ) {
25
23
var headings = $ ( "h3" ) ,
26
24
toc = $ ( "#toc-list" ) ;
@@ -41,15 +39,13 @@ $(function(){
41
39
42
40
item = $ ( '<li><a href="#' + headingSep + '">' + headings [ h ] . innerHTML + '</a></li>' ) ;
43
41
toc . append ( item ) ;
44
- // console.log(headings[h].parentElement);
45
-
46
- // var hiddenTitle = document.createElement("h3");
47
- // hiddenTitle.setAttribute("id", headingSep);
48
- // console.log(hiddenTitle);
49
42
50
- // $(headings[h].parentElement).prepend(hiddenTitle);
51
-
52
- headings [ h ] . parentElement . setAttribute ( "id" , headingSep ) ;
43
+ if ( headings [ h ] . parentElement . getAttribute ( "class" ) . indexOf ( "alignment" ) > - 1 ) {
44
+ headings [ h ] . parentElement . setAttribute ( "id" , headingSep ) ;
45
+ }
46
+ else {
47
+ headings [ h ] . setAttribute ( "id" , headingSep ) ;
48
+ }
53
49
54
50
$ ( '.curriculum' ) . scrollspy ( { target : '#toc' } ) ;
55
51
}
You can’t perform that action at this time.
0 commit comments