-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
166 lines (139 loc) · 4.58 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
var preloader=document.getElementById('loading');
function myfunction(){
setTimeout(function(){preloader.style.display= 'none'},1000);
}
//comment out this part to see the preloader
window.onload= myfunction();
var _CONTENT = [
"Student chapter BIT Mesra",
"Technology Innvovation Creativity",
];
console.log(screen.width);
var _PART = 0;
var _PART_INDEX = 0;
var _INTERVAL_VAL;
var _ELEMENT = document.querySelector("#text");
var _CURSOR = document.querySelector("#cursor");
function Type() {
var text = _CONTENT[_PART].substring(0, _PART_INDEX + 1);
_ELEMENT.innerHTML = text;
_PART_INDEX++;
if(text === _CONTENT[_PART]) {
_CURSOR.style.display = 'none';
clearInterval(_INTERVAL_VAL);
setTimeout(function() {
_INTERVAL_VAL = setInterval(Delete, 50);
}, 1000);
}
}
function Delete() {
var text = _CONTENT[_PART].substring(0, _PART_INDEX - 1);
_ELEMENT.innerHTML = text;
_PART_INDEX--;
if(text === '') {
clearInterval(_INTERVAL_VAL);
if(_PART == (_CONTENT.length - 1))
_PART = 0;
else
_PART++;
_PART_INDEX = 0;
setTimeout(function() {
_CURSOR.style.display = 'inline-block';
_INTERVAL_VAL = setInterval(Type, 100);
}, 200);
}
}
setTimeout(function(){_INTERVAL_VAL = setInterval(Type, 100);},3000);
var y=0;
const nav_slide = ()=>{
// const nav_bar =document.querySelector(".bar");
const burger = document.querySelector(".burger");
const nav= document.querySelector(".nav-links");
burger.addEventListener("click",()=>{
// nav_bar.add("chback");
y++;
nav.classList.toggle("nav-active");
burger.classList.toggle("toggle");
});
}
nav_slide();
var x;
var f=screen.height;
f=f-150;
console.log(f);
$(window).on('scroll',function(){
console.log($(window).scrollTop());
console.log("sabhdgh" + f);
if(y%2==1)
window.scrollTo(0,x);
else{
if(($(window).scrollTop()-x)>0 && $(window).scrollTop()>=f)
{
// console.log("yes");
$(".bar").addClass('x');
}
else
$(".bar").removeClass('x');
x=$(window).scrollTop();
}
});
function getId(element)
{
console.log("hello");
location.href="./articleonclick.html";
}
// Get the modal
var modal = document.getElementById("myModal1");
// Get the button that opens the modal
var btn = document.getElementsByClassName("list-item");
// Get the <span> element that closes the modal
var span = document.getElementById("overlay");
// When the user clicks on the button, open the modal
function on(x) {
document.getElementById("overlay").style.display = "block";
$('.pop-box').empty();
$('#event-'+x).clone().appendTo('.pop-box');
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
document.getElementById("overlay").style.display = "none";
}
function showUser() {
email = document.getElementById('emailSubscribe').value;
name = document.getElementById('nameSubscribe').value;
if (email=="" || name=="") {
document.getElementById("alertBox").innerHTML="";
return;
}
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var data = new FormData();
data.append('email', email);
data.append('name', name);
var params = "email="+email+"&name="+name;
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
$("#alertBox").fadeTo(2000, 500).slideUp(500, function() {
$("#alertBox").slideUp(500);
document.getElementById("closeAlert").style.display="block";
});
document.getElementById("alertData").innerHTML = this.responseText;
document.getElementById("closeAlert").style.display="block";
if(this.responseText == "Already, subscribed") {
document.getElementById("alertBox").className = "alert alert-warning";
} else if (this.responseText == "Sucessfully subscribed") {
document.getElementById("alertBox").className = "alert alert-success";
} else if (this.responseText == "Invalid input") {
document.getElementById("alertBox").className = "alert alert-danger";
}
}
};
//console.log(data);
xmlhttp.open("POST","http://localhost/subscribe.php",true);
xmlhttp.send(data);
}