Skip to content

Commit 9a59a36

Browse files
Jon SenterfittJon Senterfitt
authored andcommitted
Added target control to the toc
1 parent 3925136 commit 9a59a36

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

wiki.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ $(toc).append(panel);
4343

4444
$('#toc').wrapInner('<div class="viewport"></div>');
4545

46-
$('.toclevel-1').click(function(){
47-
$(this).find('ul').toggleClass('hide-me')
48-
})
46+
$('.toclevel-1').click(function(event){
47+
console.log($(this));
48+
49+
var target = $( event.target );
50+
if ( target.is( "li" ) ) {
51+
$(this).find('ul').toggleClass('hide-me')
52+
}
53+
54+
});
4955

5056

5157
// copied from https://www.w3schools.com/howto/howto_js_collapsible.asp

0 commit comments

Comments
 (0)