Skip to content

added more functions #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions fylo-landing-page/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const header = document.querySelector('header');
const getForms = document.querySelectorAll('form');
const textErrors = document.querySelectorAll('.erro-text');
const btns = document.querySelectorAll('button');


window.addEventListener('scroll', function () {
if (window.scrollY > 0) {
header.style.backgroundColor = "$header-bg";
header.style.backgroundColor = "/* Your color or variable here */";
header.style.backdropFilter = "blur(50px)";
header.style.boxShadow = "0 4px 6px rgba(0, 0, 0, 0.1)";
header.style.transition = "all 0.5s ease";
Expand All @@ -17,35 +16,48 @@ window.addEventListener('scroll', function () {
}
});

getForms.forEach((form) => {
getForms.forEach((form, index) => {
const inputTag = form.querySelector('input[type="email"]');
const textBox = form.querySelector('input');
const textError = form.querySelector('.erro-text');
const btns = form.querySelector('button');


form.addEventListener('submit', function (event) {
if (inputTag.value === '') {
textError.textContent = "Please provide a valid email";
textError.style.textAlign = "left";
textError.style.color = "#E4859F";
textBox.style.border = "2px solid #E4859F";

if (index === 1) {
textError.style.color = "white";
} else {
textError.style.color = "#E4859F";
}

event.preventDefault();
} else if (inputTag.value !== '') {
textError.textContent = "Plase check your email";
textError.textContent = "Please check your email";
textError.style.textAlign = "left";
textError.style.color = "pink";
textBox.style.border = "2px solid pink";

if (index === 1) {
textError.style.color = "white";
} else {
textError.style.color = "#E4859F";
}

event.preventDefault();
btns.addEventListener('click', function () {
textError.style.color = "transparent";
textBox.value = "";
});
} else {
textError.style.color = "transparent";
textBox.textContent = "";

}
});
});

btns.forEach((btn) => {
btn.addEventListener('click', function (event) {
;


});
});