-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
80 lines (68 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
const saluteTextContainer = document.querySelector(".saluteTextContainer");
const saluteTextContainer2 = document.querySelector(".saluteTextContainer2");
const ourName = document.querySelector(".name");
const jobTitles = document.querySelectorAll(".jobTitle");
const projectTitle = document.querySelector(".projectTitle");
const phone = document.querySelector(".phone");
const laptop = document.querySelector(".laptop");
const inputs = document.querySelectorAll(".input");
const discordBtn = document.querySelector(".discord-btn");
window.addEventListener("scroll", () => {
let offsetY = window.scrollY;
saluteTextContainer.style.transform = `translateY(${offsetY * 0.3}px)`;
saluteTextContainer2.style.transform = `translate(${offsetY * 0.2}px, ${offsetY * 0.3}px)`;
ourName.style.transform = `translateX(${offsetY * 0.2}px)`;
jobTitles[0].style.transform = `translateX(calc(200vh - ${offsetY * 0.9}px))`;
jobTitles[1].style.transform = `translateX(calc(-300vh + ${offsetY}px))`;
projectTitle.style.transform = `translateY(calc(400vh - ${offsetY}px))`;
phone.style.transform = `translateX(calc(500vh - ${offsetY}px))`;
laptop.style.transform = `translateX(calc(600vh - ${offsetY}px))`;
});
function focusFunc() {
let parent = this.parentNode;
parent.classList.add("focus");
}
function blurFunc() {
let parent = this.parentNode;
if (this.value == "") {
parent.classList.remove("focus");
}
}
inputs.forEach((input) => {
input.addEventListener("focus", focusFunc);
input.addEventListener("blur", blurFunc);
});
discordBtn.addEventListener("click", function () {
window.open("https://discord.com/invite/vibr-support-939509053623795732", "_blank");
});
$(document).ready(function () {
$(window).scroll(function () {
// sticky navbar on scroll script
if (this.scrollY > 20) {
$('.navbar').addClass("sticky");
} else {
$('.navbar').removeClass("sticky");
}
});
$('.navbar .menu li a').click(function(){
// applying again smooth scroll on menu items click
$('html').css("scrollBehavior", "smooth");
});
// toggle menu/navbar script
$('.menu-btn').click(function(){
$('.navbar .menu').toggleClass("active");
$('.menu-btn i').toggleClass("active");
});
$('a.menu-btn-circular').click(function() {
var target = $($(this).attr('href'));
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 500);
return false;
}
});
$('.footer-links a').click(function(){
$('html').css("scrollBehavior","smooth");
});
});