-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscript.js
93 lines (82 loc) · 2.52 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
function menu() {
var navbar = document.getElementById("navbar");
var fa=document.getElementById("fa");
if (navbar.className === "navbar") {
navbar.className += " responsive";
fa.className="fa fa-times";
} else {
navbar.className = "navbar";
fa.className="fa fa-bars";
}
}
var TxtType = function(el, toRotate, period) {
this.toRotate = toRotate;
this.el = el;
this.loopNum = 0;
this.period = parseInt(period, 10) || 2000;
this.txt = '';
this.tick();
this.isDeleting = false;
};
TxtType.prototype.tick = function() {
var i = this.loopNum % this.toRotate.length;
var fullTxt = this.toRotate[i];
if (this.isDeleting) {
this.txt = fullTxt.substring(0, this.txt.length - 1);
} else {
this.txt = fullTxt.substring(0, this.txt.length + 1);
}
if (fullTxt=="Be an asset to everyone"){
this.el.innerHTML = '<span class="wrap">'+this.txt+'</span>';
}
else{
this.el.innerHTML = '<span class="wrap" style="color:#63BB54;">'+this.txt+'</span>';
}
var that = this;
var delta = 100;
if (this.isDeleting) { delta /= 2; }
if (!this.isDeleting && this.txt === fullTxt) {
delta = this.period;
this.isDeleting = true;
} else if (this.isDeleting && this.txt === '') {
this.isDeleting = false;
this.loopNum++;
delta = 400;
}
setTimeout(function() {
that.tick();
}, delta);
};
function showPage() {
document.getElementById("loader").style.display = "none";
document.getElementById("post-loading").style.display="block";
};
function changeImage(){
document.logo.src=images[i];
if (i<images.length-1){
i++;
}
else{
i=0;
}
setTimeout(changeImage,300);
}
var i=0;
var images=[];
images[0]="assets/preloader/1.png";
images[1]="assets/preloader/2.png";
images[2]="assets/preloader/3.png";
images[3]="assets/preloader/4.png";
window.onload = function() {
var load=changeImage()
var preload = setTimeout(showPage, 2500);
var elements = document.getElementsByClassName('typewriter');
for (var i=0; i<elements.length; i++) {
var toRotate = elements[i].getAttribute('data-type');
var period = elements[i].getAttribute('data-period');
if (toRotate) {
new TxtType(elements[i], JSON.parse(toRotate), period);
}
}
alert("This website is currently under development. Visit https://finnecoiitg.github.io/courses/Options/ for the Introductory Options course.");
};