diff --git a/assets/js/gp-form.js b/assets/js/gp-form.js index 51cab51..f7cec43 100644 --- a/assets/js/gp-form.js +++ b/assets/js/gp-form.js @@ -156,3 +156,30 @@ function listInputRadio(main ,item, textClass, input, content, block) { }) }) } + +remoteControl('.form-input__remote-control', '.form-input-tabs__button'); + +function remoteControl(main, button) { + let mains = document.querySelectorAll(main); + + mains.forEach(main => { + let subjectClass = main.dataset.content, + subject = document.querySelector(`.${subjectClass}`), + buttons = Array.from(main.querySelectorAll(button)); + + + + main.addEventListener('mousedown', function (eventMain) { + setTimeout(() => { + let indexActive = buttons.findIndex((button, index) => { + if (button.classList.contains('active')) { + return true; + } + }); + + subject.querySelector('.active').classList.remove('active'); + subject.children[indexActive].classList.add('active'); + }, 0); + }) + }) +} \ No newline at end of file diff --git a/registration.html b/registration.html index 44aa21f..7f52f44 100644 --- a/registration.html +++ b/registration.html @@ -952,7 +952,7 @@