Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :root {
- --main-bg-color: white;
- --text-color: #9932cc;
- }
- body {
- background-color: white;
- }
- .modal__window {
- background-color: white;
- position: fixed;
- width: 380px;
- margin: auto;
- left: 0;
- right: 0;
- top: 20%;
- font-family: "Rubik", sans-serif;
- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5);
- }
- .modal__window .modal__window__label {
- height: 70px;
- text-align: center;
- padding-top: 25px;
- background-color: var(--main-bg-color);
- color: rgba(0, 0, 0, 0.719);
- font-size: 23px;
- text-transform: uppercase;
- position: relative;
- padding-bottom: 15px;
- border-bottom: 1.4px solid var(--text-color);
- }
- .modal__window__form {
- margin-top: 35px;
- }
- .modal__window .modal__window__form .modal__window__form__object {
- height: 65px;
- font-size: 15px;
- margin: 8px auto;
- display: flex;
- flex-flow: column;
- width: 80%;
- }
- .modal__window .modal__window__form .modal__window__form__object input {
- height: 45px;
- padding-left: 10px;
- font-size: 17px;
- border: 1px solid #cccccc;
- outline: none;
- border-radius: 1px;
- background-color: #00000007;
- }
- .modal__window .modal__window__form .modal__window__form__button {
- text-align: center;
- }
- .modal__window .modal__window__form .modal__window__form__button {
- left: 0;
- width: 200px;
- height: 45px;
- display: flex;
- text-align: center;
- margin: auto;
- margin-bottom: 25px;
- /* position: relative;
- box-sizing: border-box;
- background: white;
- background-clip: padding-box;
- border: solid 3px transparent;
- border-radius: 1em;*/
- }
- .modal__window .modal__window__form .modal__window__form__button button {
- text-transform: uppercase;
- font-family: "Rubik", sans-serif;
- background-color: white;
- color: var(--text-color);
- border: none;
- border: 1.4px solid var(--text-color);
- border-radius: 4px;
- /* border-radius: inherit; !importanté */
- height: 45px;
- width: 200px;
- outline: none;
- font-size: 15px;
- /* background: linear-gradient(to right, #f6d365 0%, #fda085 51%, #f6d365 100%);
- display: table;
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent; */
- }
- /* .modal__window .modal__window__form .modal__window__form__button::before {
- content: "";
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: -1;
- margin: -3px;
- border-radius: inherit;
- background: linear-gradient(to right, #f6d365 0%, #fda085 51%, #f6d365 100%);
- } */
- .modal__window
- .modal__window__form
- .modal__window__form__object
- .modal__form__error {
- height: 15px;
- font-size: 13px;
- color: red;
- text-align: left;
- display: none;
- }
- .modal__success {
- position: fixed;
- left: 0;
- right: 0;
- margin: auto;
- text-align: center;
- width: 19%;
- padding: 15px 25px;
- background-color: white;
- font-size: 15px;
- border: 1px solid black;
- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5);
- font-family: "Rubik", sans-serif;
- }
- .text__button button {
- font-size: 20px;
- margin: 30px;
- border: none;
- text-transform: lowercase;
- font-family: Rubik;
- color: black;
- padding: 15px 25px;
- background-color: #ffd200;
- box-shadow: 1px 1px #dab200;
- outline: none;
- -webkit-transition: 0.5s ease; /* Safari and Chrome */
- -moz-transition: 0.5s ease; /* Firefox 4 */
- -o-transition: 0.5s ease; /* Opera */
- }
- .text__button button:hover {
- box-shadow: 1px 1px #dab200, 2px 2px #dab200, 3px 3px #dab200, 4px 4px #dab200;
- -webkit-transform: translateX(-3px);
- transform: translateX(-3px);
- -webkit-transition: all 0.5s ease;
- -moz-transition: all 0.5s ease;
- -o-transition: all 0.5s ease;
- transition: all 0.5s ease;
- }
- let error = false;
- const regNumber = /^((\+7|7|8)+([0-9]){10})$/gm;
- const regEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
- const errorMessage = document.getElementsByClassName("modal__form__error");
- function send(event) {
- event.preventDefault();
- let firstNumberError = false;
- let firstEmailError = false;
- const email = document.getElementsByClassName("modal__email");
- const number = document.getElementsByClassName("modal__number");
- const label = document.getElementsByClassName("modal__window__label");
- label[0].style.setProperty("--main-bg-color", "white");
- if (number[0].value === "") {
- errorMessage[0].style.display = "block";
- number[0].style.border = "1px solid red";
- error = true;
- firstNumberError = true;
- }
- if (email[0].value === "") {
- errorMessage[2].style.display = "block";
- email[0].style.border = "1px solid red";
- error = true;
- firstEmailError = true;
- }
- if (number[0].value.match(regNumber) === null && !firstNumberError) {
- errorMessage[1].style.display = "block";
- number[0].style.border = "1px solid red";
- error = true;
- }
- if (email[0].value.match(regEmail) === null && !firstEmailError) {
- errorMessage[3].style.display = "block";
- email[0].style.border = "1px solid red";
- error = true;
- }
- if (!error) {
- console.log("123");
- }
- }
- document.getElementById("modal__form").addEventListener("submit", send);
- const onChangeNumber = document.getElementById("modal__form__error__number");
- onChangeNumber.addEventListener("input", event => {
- errorMessage[1].style.display = "none";
- if (onChangeNumber.value !== "") {
- errorMessage[0].style.display = "none";
- onChangeNumber.style.border = "1px solid #cccccc";
- error = false;
- }
- });
- const onChangeEmail = document.getElementById("modal__form__error__email");
- onChangeEmail.addEventListener("input", event => {
- errorMessage[3].style.display = "none";
- if (onChangeEmail.value !== "") {
- errorMessage[2].style.display = "none";
- onChangeEmail.style.border = "1px solid #cccccc";
- error = false;
- }
- });
- <!DOCTYPE html>
- <html>
- <head>
- <title>Parcel Sandbox</title>
- <meta charset="UTF-8" />
- <link
- rel="stylesheet"
- href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
- crossorigin="anonymous"
- />
- <link
- href="https://fonts.googleapis.com/css?family=Rubik&display=swap"
- rel="stylesheet"
- />
- <link rel="stylesheet" href="./style.css" />
- <script
- src="https://code.jquery.com/jquery-3.4.1.js"
- integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
- crossorigin="anonymous"
- ></script>
- <script src="index.js"></script>
- </head>
- <body>
- <div class="modal__window">
- <div class="modal__window__label">
- <span>Оставьте вашу заявку</span>
- </div>
- <div class="modal__window__form">
- <form action=" " id="modal__form">
- <div class="modal__window__form__object">
- <input
- autocomplete="off"
- type="text"
- id="name"
- name="user_name"
- placeholder="Введите ваше имя"
- />
- </div>
- <div class="modal__window__form__object">
- <input
- autocomplete="off"
- class="modal__number"
- type="text"
- id="modal__form__error__number"
- name="user_number"
- placeholder="Введите ваш телефон"
- />
- <div class="modal__form__error">
- <span>Поле обязательно для заполнениия</span>
- </div>
- <div class="modal__form__error">
- <span>Проверьте правильность веденного номера</span>
- </div>
- </div>
- <div class="modal__window__form__object">
- <input
- autocomplete="off"
- class="modal__email"
- type="text"
- id="modal__form__error__email"
- name="user_mail"
- placeholder="Введите ваш email"
- />
- <div class="modal__form__error">
- <span>Поле обязательно для заполнениия</span>
- </div>
- <div class="modal__form__error">
- <span>Проверьте правильность веденного email</span>
- </div>
- </div>
- <div class="modal__window__form__button">
- <button type="submit" class="modal__window__form__thebutton">
- Отправить заявку
- </button>
- </div>
- </form>
- </div>
- </div>
- <div class="modal__success">
- <div class="modal_success__container">
- <span>ВАША ЗАЯВКА ПРИНЯТА</span>
- </div>
- </div>
- <div class="text__button">
- <button>
- обратная связь
- </button>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement