forked from notdana/Bloggly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
114 lines (74 loc) · 2.73 KB
/
main.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
//Materialize stuff
// $(document).ready(function(){
// $('.tabs').tabs();
// })
$(document).ready(function(){
$('.collapsible').collapsible();
});
// _________________JS__________________
//LOADING PAGE
let loading=document.querySelector(".loadingContainer");
window.addEventListener('load',function(){
loading.parentNode.removeChild(loading);
});
//INTRO BUTTON
const introBtn= document.querySelector(".introBtn");
const landingPage= document.querySelector(".landingPage");
introBtn.addEventListener('click',()=>{
landingPage.style.display="none";
document.querySelector('body').style.overflow="visible";
});
introBtn.classList.add("introBtnShow");
//HAMBRGER MENU OPEN
const navBtn = document.getElementById("navbtn");
const navMen= document.querySelector(".listContainer");
navBtn.addEventListener('click',()=>{
navBtn.classList.toggle("cross");
navMen.classList.toggle("slide");
});
// _____________END OF JS______________
//__________________________GSAP________________________________
//into letters
gsap.to(".letter", { duration: 2, ease: "back", x: 2000,stagger: 0.3});
// _______________________END OF GSAP_____________________________
//_______________________OTHER_______________________-
// SMOOTH SCROLL
const scroll = new SmoothScroll('.nav a[href*="#"]', {
speed: 800
});
//_______________________CONTACT_______________________-
document.querySelector(".card-toggle").addEventListener("click", function(){
// Card toggle state
document.querySelector(".card-toggle").classList.remove("active");
document.querySelector(this).classList.add("active");
var isAnimating = false;
if( !isAnimating ){
isAnimating = true;
document.querySelector(".card").querySelector(".card-content").css("z-index",0);
document.querySelector(".card").classList.remove("active");
var that = document.querySelector(this);
document.querySelector(this).siblings().css("z-index",1);
setTimeout(function(){
that.parent().classList.toggle("active").querySelector(".card-content").addEventListener("transitionend", function(){
isAnimating = false;
}); ;
},10);
} else {
return;
}
});
document.querySelector("input,textarea").blur(function(){
if( document.querySelector(this).value ){
document.querySelector(this).parent().classList.add("filled");
} else {
document.querySelector(this).parent().classList.remove("filled");
}
});
document.querySelector(".contact").addEventListener("click",function(){
document.querySelector(".contact-form").classList.toggle("active");
});
document.querySelector(".contact-form input[type=submit], .contact-form .close").addEventListener("click",function(e){
e.preventDefault();
document.querySelector(".contact-form").classList.toggle("active")
});
//Materialize stuff