-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.js
38 lines (33 loc) · 1016 Bytes
/
jquery.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
// taken from the 6th answer on this
//stack overflow question
//https://stackoverflow.com/questions/15603390/toggle-between-2-functions
var toggle = function (a, b) {
var togg = false;
return function () {
// passes return value back to caller
return (togg = !togg) ? a() : b();
};
};
//animates the canvas drawing
$('#animate').click(toggle (function (){
myAnimation();
$('#animate').html("reset") ;
}, function (){
location.reload()
}));
//animates the svg drawing
$("#fall").click(toggle (function (){
animateStones();
$('#fall').html("reset");
$("#lightning").fadeTo("fast", 1);
}, function (){
location.reload()
}));
//animates the documentation text
$("#dokumentasjon").click(toggle (function (){
$("#dokumentasjon-innhold").css("display","none");
$("#dokumentasjon").text("show documentation");
}, function (){
$("#dokumentasjon-innhold").css("display","block");
$("#dokumentasjon").text("hide documentation");
}))