-
Notifications
You must be signed in to change notification settings - Fork 0
/
myScripts.js
40 lines (30 loc) · 1.26 KB
/
myScripts.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
$.fn.exists = function () {
return this.length !== 0;
}
//while(document.readyState != "interactive") console.log("waitingForReady");
var BackgroundArray = [];
$(document).ready(function () {
BackgroundArray["#Home"] = "url('spacephoto.jpeg')";
BackgroundArray["#About"] = "url(ripple.jpg)";
BackgroundArray["#Skills"] = "url(keyboardBG2.jpg)";
BackgroundArray["#Projects"] = "url(computer.jpeg)";
BackgroundArray["#Contact"] = "none";
var text = '#'+$('.active').text();
$('.bodyDiv').hide();
//console.log(text, $(text));
$(text).show();
//console.log($('.topnav').exists());
$('.topnav li').click(function(){
if ($(this).hasClass('active')) {
return;
}
$('.topnav li').removeClass('active')
$(this).addClass('active');
var text = '#'+$('.active').text();
$('.bodyDiv').hide();
//console.log(text, $(text));
$(text).show();
$("body").css("background-image", BackgroundArray[text]);
text = '';
});
});