Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Mobile first Coming Soon page with Js

@vivienbalint

Desktop design screenshot for the Base Apparel coming soon page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Opinions? Could have done it with only HTML and CSS but wanted to practice JavaScript as well :)

Community feedback

P
ApplePieGiraffe‱ 30,565

@ApplePieGiraffe

Posted

Hey, Vivien Bálint! 👋

Nice job on this challenge (as usual)! Your solution looks good and scales up/down quite well! 👍

It would be worth switching to a mobile-friendly layout somewhere below 1414px, since (as tediko suggested) the hero image is very large and there's still some space for the desktop layout (and you can create even more space by allowing the width of the image to decrease with the width of the screen—just add object-fit: cover to the image to make sure it doesn't get distorted). 😉

Keep coding (and happy coding, too)! 😁

1

@vivienbalint

Posted

Thank you, should be fixed! :)

0
P
tediko‱ 6,580

@tediko

Posted

Hello, Vivien Bálint! 👋

Congratulations on finishing this challenge! Your solution responds well. What i can suggest is:

  • Image below 1400width screen sizes is huge. Add some max-width to prevent that and keep it nice.

  • I believe you forgot disable default error tool-tip from browser. Now if i type wrong email your invalid message is overflow by browser default message. Your error message font-size is also a bit to small.

  • Give your input some aria-label for accessibility.

If you want to see how I made this challenge, here is the link. Like most people here I also learn but maybe you will find something good for yourself.

Good luck with that, have fun coding! đŸ’Ș

1

@vivienbalint

Posted

Thank you! I fixed these, but I have no idea how to disable the error message, any suggestions? :D

0
P
tediko‱ 6,580

@tediko

Posted

@vivienbalint The simplest take is to add novalidate attribute to your form html. This way you disable client side validation for a form. In doing so you will also have to use method preventDefault() on your button to prevent it from default behavior which is sending. To do this pass event as argument to your function within eventlistener and then call the method preventDefault() on it (like. event.preventDefault()). You will then have to send the form manually if the input meets your validation in javascript. To do so, add form.submit() when your validation if is true.

  1. Add novalidate attribute to form. <form id="form" novalidate>

  2. Add the preventDefault() method to your button. Doing that default action that belongs to the event will not occur.

btn.addEventListener("click", (event) => {
  let value = email.value;
  event.preventDefault()   <---- HERE
  validateEmail(value);`
});
  1. Add manualy form.submit(). Previously we removed submit event from button and validation from form, so now we have to manually call submit method on form. When our condition with email validation is true simply submit it using form.submit().
function validateEmail(email) {
  if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email)) {
    form.classList.remove("error");
    form.submit(); <---- HERE
  } else {
    form.classList.add("error");
  }
}
1

@vivienbalint

Posted

Wow, thank you Tediko for your help, fixed it! ;)

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord