3 changed files with 22 additions and 1 deletions
@ -0,0 +1,3 @@ |
|||||||
|
<script type="text/javascript" src="js/tocbot/tocbot.min.js"></script> |
||||||
|
<script type="text/javascript" src="js/toc.js"></script> |
||||||
|
<script type="text/javascript" src="js/switch-language.js"></script> |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
function globalSwitch() { |
||||||
|
$('.switch--item').each(function() { |
||||||
|
$(this).off('click'); |
||||||
|
$(this).on('click', function() { |
||||||
|
selectedText = $(this).text() |
||||||
|
selectedIndex = $(this).index() |
||||||
|
$(".switch--item").filter(function() { return ($(this).text() === selectedText) }).each(function() { |
||||||
|
$(this).addClass('selected'); |
||||||
|
$(this).siblings().removeClass('selected'); |
||||||
|
selectedContent = $(this).parent().siblings(".content").eq(selectedIndex) |
||||||
|
selectedContent.removeClass('hidden'); |
||||||
|
selectedContent.siblings().addClass('hidden'); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
$(globalSwitch); |
||||||
Loading…
Reference in new issue