-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
executable file
·43 lines (37 loc) · 1.01 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function updatePage() {
var hash = window.location.hash;
var pageElement;
if (hash && hash !== "") {
pageElement = $(hash);
}
$('.page-content.visible').removeClass("visible");
$('#sidebar-wrapper a').removeClass("active");
if(pageElement) {
pageElement.addClass("visible");
$('#sidebar-wrapper a[href="'+hash+'"]').addClass("active");
} else {
$('.page-content:first').addClass("visible");
}
}
window.onhashchange = updatePage;
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
var AudioContext = window.AudioContext || window.webkitAudioContext;
new AudioContext();
var audio;
$('.comic img').click(function(event) {
event.preventDefault();
var audiofile = event.target.getAttribute('audio');
if(audiofile) {
if (audio) {
audio.pause()
}
audio = new Audio(audiofile);
audio.play();
}
})
$(document).ready(function() {
updatePage();
});