-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
105 lines (82 loc) · 3.11 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
const floatingButton = document.querySelector("#floating-button");
const facebookTop = document.querySelector("#facebook");
const twitterTop = document.querySelector("#twitter");
const instagramTop = document.querySelector("#instagram");
const allServices = document.querySelector("#view-services");
const allProjects1 = document.querySelector("#view-projects");
const allProjects2 = document.querySelector("#all-projects");
const address = document.querySelector("#address");
const email = document.querySelector("#email");
const phone = document.querySelector("#phone");
const facebookBottom = document.querySelector("#fb");
const twitterBottom = document.querySelector("#tw");
const instagramBottom = document.querySelector("#ig");
const submit = document.querySelector("#submit");
floatingButton.addEventListener("click", () => {
const name = document.querySelector("#name");
name.focus();
});
facebookTop.addEventListener("click", () => {
window.open("https://www.facebook.com", "_blank");
});
twitterTop.addEventListener("click", () => {
window.open("https://www.twitter.com", "_blank");
});
instagramTop.addEventListener("click", () => {
window.open("https://www.instagram.com", "_blank");
});
allServices.addEventListener("click", () => {
window.location.replace("services.html");
});
allProjects1.addEventListener("click", () => {
window.location.replace("projects.html");
});
allProjects2.addEventListener("click", () => {
window.location.replace("projects.html");
});
address.addEventListener("click", () => {
window.open("https://maps.app.goo.gl/5m1g4FdhL5N5Hjdr6", "_blank");
});
email.addEventListener("click", () => {
window.open("mailto:[email protected]", "_blank");
});
phone.addEventListener("click", () => {
window.open("tel:+1-888-405-8908", "_blank");
});
facebookBottom.addEventListener("click", () => {
window.open("https://www.facebook.com", "_blank");
});
twitterBottom.addEventListener("click", () => {
window.open("https://www.twitter.com", "_blank");
});
instagramBottom.addEventListener("click", () => {
window.open("https://www.instagram.com", "_blank");
});
submit.addEventListener("click", () => {
const name = document.querySelector("#name");
const email = document.querySelector("#email");
const phone = document.querySelector("#phone");
const message = document.querySelector("#message");
if (name.validity.valueMissing) {
name.setCustomValidity("Please enter your name");
} else {
name.setCustomValidity("");
}
if (email.validity.valueMissing) {
email.setCustomValidity("Please enter your email");
} else if (email.validity.typeMismatch) {
email.setCustomValidity("Please enter a valid email");
} else {
email.setCustomValidity("");
}
if (phone.validity.valueMissing) {
phone.setCustomValidity("Please enter your phone number");
} else {
phone.setCustomValidity("");
}
if (message.validity.valueMissing) {
message.setCustomValidity("Please enter your message");
} else {
message.setCustomValidity("");
}
});