Advertisement
Guest User

123123

a guest
Jun 20th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.96 KB | None | 0 0
  1. :root {
  2. --main-bg-color: white;
  3. --text-color: #9932cc;
  4. }
  5.  
  6. body {
  7. background-color: white;
  8. }
  9.  
  10. .modal__window {
  11. background-color: white;
  12. position: fixed;
  13. width: 380px;
  14. margin: auto;
  15. left: 0;
  16. right: 0;
  17. top: 20%;
  18. font-family: "Rubik", sans-serif;
  19. box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5);
  20. }
  21. .modal__window .modal__window__label {
  22. height: 70px;
  23. text-align: center;
  24. padding-top: 25px;
  25. background-color: var(--main-bg-color);
  26. color: rgba(0, 0, 0, 0.719);
  27. font-size: 23px;
  28. text-transform: uppercase;
  29. position: relative;
  30. padding-bottom: 15px;
  31. border-bottom: 1.4px solid var(--text-color);
  32. }
  33. .modal__window__form {
  34. margin-top: 35px;
  35. }
  36. .modal__window .modal__window__form .modal__window__form__object {
  37. height: 65px;
  38. font-size: 15px;
  39. margin: 8px auto;
  40. display: flex;
  41. flex-flow: column;
  42. width: 80%;
  43. }
  44.  
  45. .modal__window .modal__window__form .modal__window__form__object input {
  46. height: 45px;
  47. padding-left: 10px;
  48. font-size: 17px;
  49. border: 1px solid #cccccc;
  50. outline: none;
  51. border-radius: 1px;
  52. background-color: #00000007;
  53. }
  54.  
  55. .modal__window .modal__window__form .modal__window__form__button {
  56. text-align: center;
  57. }
  58. .modal__window .modal__window__form .modal__window__form__button {
  59. left: 0;
  60. width: 200px;
  61. height: 45px;
  62. display: flex;
  63. text-align: center;
  64. margin: auto;
  65. margin-bottom: 25px;
  66. /* position: relative;
  67.  
  68. box-sizing: border-box;
  69. background: white;
  70. background-clip: padding-box;
  71. border: solid 3px transparent;
  72. border-radius: 1em;*/
  73. }
  74.  
  75. .modal__window .modal__window__form .modal__window__form__button button {
  76. text-transform: uppercase;
  77. font-family: "Rubik", sans-serif;
  78. background-color: white;
  79. color: var(--text-color);
  80. border: none;
  81. border: 1.4px solid var(--text-color);
  82. border-radius: 4px;
  83. /* border-radius: inherit; !importanté */
  84. height: 45px;
  85. width: 200px;
  86. outline: none;
  87. font-size: 15px;
  88. /* background: linear-gradient(to right, #f6d365 0%, #fda085 51%, #f6d365 100%);
  89. display: table;
  90. -webkit-background-clip: text;
  91. -webkit-text-fill-color: transparent; */
  92. }
  93.  
  94. /* .modal__window .modal__window__form .modal__window__form__button::before {
  95. content: "";
  96. position: absolute;
  97. top: 0;
  98. right: 0;
  99. bottom: 0;
  100. left: 0;
  101. z-index: -1;
  102. margin: -3px;
  103. border-radius: inherit;
  104. background: linear-gradient(to right, #f6d365 0%, #fda085 51%, #f6d365 100%);
  105. } */
  106.  
  107. .modal__window
  108. .modal__window__form
  109. .modal__window__form__object
  110. .modal__form__error {
  111. height: 15px;
  112. font-size: 13px;
  113. color: red;
  114. text-align: left;
  115. display: none;
  116. }
  117.  
  118. .modal__success {
  119. position: fixed;
  120. left: 0;
  121. right: 0;
  122. margin: auto;
  123. text-align: center;
  124. width: 19%;
  125. padding: 15px 25px;
  126. background-color: white;
  127. font-size: 15px;
  128. border: 1px solid black;
  129. box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5);
  130. font-family: "Rubik", sans-serif;
  131. }
  132. .text__button button {
  133. font-size: 20px;
  134. margin: 30px;
  135. border: none;
  136. text-transform: lowercase;
  137. font-family: Rubik;
  138. color: black;
  139. padding: 15px 25px;
  140. background-color: #ffd200;
  141. box-shadow: 1px 1px #dab200;
  142. outline: none;
  143. -webkit-transition: 0.5s ease; /* Safari and Chrome */
  144. -moz-transition: 0.5s ease; /* Firefox 4 */
  145. -o-transition: 0.5s ease; /* Opera */
  146. }
  147.  
  148. .text__button button:hover {
  149. box-shadow: 1px 1px #dab200, 2px 2px #dab200, 3px 3px #dab200, 4px 4px #dab200;
  150. -webkit-transform: translateX(-3px);
  151. transform: translateX(-3px);
  152. -webkit-transition: all 0.5s ease;
  153. -moz-transition: all 0.5s ease;
  154. -o-transition: all 0.5s ease;
  155. transition: all 0.5s ease;
  156. }
  157.  
  158. let error = false;
  159.  
  160. const regNumber = /^((\+7|7|8)+([0-9]){10})$/gm;
  161. 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,}))$/;
  162. const errorMessage = document.getElementsByClassName("modal__form__error");
  163.  
  164. function send(event) {
  165. event.preventDefault();
  166. let firstNumberError = false;
  167. let firstEmailError = false;
  168. const email = document.getElementsByClassName("modal__email");
  169. const number = document.getElementsByClassName("modal__number");
  170.  
  171. const label = document.getElementsByClassName("modal__window__label");
  172. label[0].style.setProperty("--main-bg-color", "white");
  173.  
  174. if (number[0].value === "") {
  175. errorMessage[0].style.display = "block";
  176. number[0].style.border = "1px solid red";
  177. error = true;
  178. firstNumberError = true;
  179. }
  180. if (email[0].value === "") {
  181. errorMessage[2].style.display = "block";
  182. email[0].style.border = "1px solid red";
  183. error = true;
  184. firstEmailError = true;
  185. }
  186. if (number[0].value.match(regNumber) === null && !firstNumberError) {
  187. errorMessage[1].style.display = "block";
  188. number[0].style.border = "1px solid red";
  189. error = true;
  190. }
  191. if (email[0].value.match(regEmail) === null && !firstEmailError) {
  192. errorMessage[3].style.display = "block";
  193. email[0].style.border = "1px solid red";
  194. error = true;
  195. }
  196. if (!error) {
  197. console.log("123");
  198. }
  199. }
  200.  
  201. document.getElementById("modal__form").addEventListener("submit", send);
  202.  
  203. const onChangeNumber = document.getElementById("modal__form__error__number");
  204.  
  205. onChangeNumber.addEventListener("input", event => {
  206. errorMessage[1].style.display = "none";
  207. if (onChangeNumber.value !== "") {
  208. errorMessage[0].style.display = "none";
  209. onChangeNumber.style.border = "1px solid #cccccc";
  210. error = false;
  211. }
  212. });
  213.  
  214. const onChangeEmail = document.getElementById("modal__form__error__email");
  215.  
  216. onChangeEmail.addEventListener("input", event => {
  217. errorMessage[3].style.display = "none";
  218. if (onChangeEmail.value !== "") {
  219. errorMessage[2].style.display = "none";
  220. onChangeEmail.style.border = "1px solid #cccccc";
  221. error = false;
  222. }
  223. });
  224. <!DOCTYPE html>
  225. <html>
  226. <head>
  227. <title>Parcel Sandbox</title>
  228. <meta charset="UTF-8" />
  229. <link
  230. rel="stylesheet"
  231. href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
  232. integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
  233. crossorigin="anonymous"
  234. />
  235. <link
  236. href="https://fonts.googleapis.com/css?family=Rubik&display=swap"
  237. rel="stylesheet"
  238. />
  239. <link rel="stylesheet" href="./style.css" />
  240. <script
  241. src="https://code.jquery.com/jquery-3.4.1.js"
  242. integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
  243. crossorigin="anonymous"
  244. ></script>
  245. <script src="index.js"></script>
  246. </head>
  247.  
  248. <body>
  249. <div class="modal__window">
  250. <div class="modal__window__label">
  251. <span>Оставьте вашу заявку</span>
  252. </div>
  253. <div class="modal__window__form">
  254. <form action=" " id="modal__form">
  255. <div class="modal__window__form__object">
  256. <input
  257. autocomplete="off"
  258. type="text"
  259. id="name"
  260. name="user_name"
  261. placeholder="Введите ваше имя"
  262. />
  263. </div>
  264. <div class="modal__window__form__object">
  265. <input
  266. autocomplete="off"
  267. class="modal__number"
  268. type="text"
  269. id="modal__form__error__number"
  270. name="user_number"
  271. placeholder="Введите ваш телефон"
  272. />
  273. <div class="modal__form__error">
  274. <span>Поле обязательно для заполнениия</span>
  275. </div>
  276. <div class="modal__form__error">
  277. <span>Проверьте правильность веденного номера</span>
  278. </div>
  279. </div>
  280. <div class="modal__window__form__object">
  281. <input
  282. autocomplete="off"
  283. class="modal__email"
  284. type="text"
  285. id="modal__form__error__email"
  286. name="user_mail"
  287. placeholder="Введите ваш email"
  288. />
  289. <div class="modal__form__error">
  290. <span>Поле обязательно для заполнениия</span>
  291. </div>
  292. <div class="modal__form__error">
  293. <span>Проверьте правильность веденного email</span>
  294. </div>
  295. </div>
  296.  
  297. <div class="modal__window__form__button">
  298. <button type="submit" class="modal__window__form__thebutton">
  299. Отправить заявку
  300. </button>
  301. </div>
  302. </form>
  303. </div>
  304. </div>
  305.  
  306. <div class="modal__success">
  307. <div class="modal_success__container">
  308. <span>ВАША ЗАЯВКА ПРИНЯТА</span>
  309. </div>
  310. </div>
  311.  
  312. <div class="text__button">
  313. <button>
  314. обратная связь
  315. </button>
  316. </div>
  317. </body>
  318. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement