-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
58 lines (48 loc) · 1.93 KB
/
script.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$(window).load(function(){
var body = $("body"),
universe = $("#universe"),
solarsys = $("#solar-system");
var init = function() {
body.removeClass('view-2D opening').addClass("view-3D").delay(2000).queue(function() {
$(this).removeClass('hide-UI').addClass("set-speed");
$(this).dequeue();
});
};
var setView = function(view) { universe.removeClass().addClass(view); };
$("#toggle-data").click(function(e) {
body.toggleClass("data-open data-close");
e.preventDefault();
});
$("#toggle-controls").click(function(e) {
body.toggleClass("controls-open controls-close");
e.preventDefault();
});
$("#data a").click(function(e) {
var ref = $(this).attr("class");
solarsys.removeClass().addClass(ref);
$(this).parent().find('a').removeClass('active');
$(this).addClass('active');
e.preventDefault();
});
$(".set-view").click(function() { body.toggleClass("view-3D view-2D"); });
$(".set-zoom").click(function() { body.toggleClass("zoom-large zoom-close"); });
$(".set-speed").click(function() { setView("scale-stretched set-speed"); });
$(".set-size").click(function() { setView("scale-s set-size"); });
$(".set-distance").click(function() { setView("scale-d set-distance"); });
init();
$(document).ready(function () {
var solarSound = document.getElementById('solarSound');
var isPlaying = false;
// Play the audio when the "Start/Stop" button is clicked
$("#startStopButton").click(function () {
if (isPlaying) {
solarSound.pause(); // Pause the audio
isPlaying = false;
} else {
solarSound.currentTime = 0; // Reset the audio to the beginning
solarSound.play(); // Play the audio
isPlaying = true;
}
});
});
});