From bbab08ef98f3af8bcfcefc31ec89c997775ca307 Mon Sep 17 00:00:00 2001 From: Keks Date: Mon, 16 Dec 2024 15:55:38 +0300 Subject: [PATCH] =?UTF-8?q?:heavy=5Fcheck=5Fmark:=20=D0=A1=D0=B1=D0=BE?= =?UTF-8?q?=D1=80=D0=BA=D0=B0=20#10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10/js/form.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/10/js/form.js b/10/js/form.js index 64b1252..46340d1 100644 --- a/10/js/form.js +++ b/10/js/form.js @@ -52,6 +52,8 @@ const sliderContainer = document.querySelector('.img-upload__effect-level'); const pristine = setupUploadFormValidation(form, textHashtags, textDescription); +const changeEvent = new Event('change'); + createSlider(sliderBar, MIN_SLIDER_VALUE, MAX_SLIDER_VALUE, STEP_SLIDER); updateValueField(sliderBar, effectLevelValue); @@ -138,7 +140,7 @@ function close() { imgUploadOverlay.classList.add('hidden'); document.body.classList.remove('modal-open'); document.removeEventListener('keydown', onKeydownEsc); - form.reset(); + resetForm(); } function setupImageEffect(radioElement, SliderVisibility, filterName) { @@ -180,3 +182,11 @@ function getFilterValue(filterName) { } return value; } + +function resetForm() { + radioEffectNone.checked = true; + radioEffectNone.dispatchEvent(changeEvent); + imgUploadPreview.style.transform = 'scale(1)'; + imgPreview.src = ''; + form.reset(); +}