fix js remoteControl
This commit is contained in:
@@ -84,6 +84,10 @@ function inputTabs(main, button) {
|
||||
|
||||
buttons.forEach(button => {
|
||||
button.onclick = function () {
|
||||
if (button.classList.contains('active')) {
|
||||
return ;
|
||||
}
|
||||
|
||||
main.querySelector('.active').classList.remove('active');
|
||||
|
||||
button.classList.add('active');
|
||||
@@ -169,15 +173,19 @@ function remoteControl(main, button) {
|
||||
subject = document.querySelector(`.${subjectClass}`),
|
||||
buttons = Array.from(main.querySelectorAll(button));
|
||||
|
||||
console.log(main);
|
||||
|
||||
|
||||
main.addEventListener('mousedown', function (eventMain) {
|
||||
main.addEventListener('click', function (eventMain) {
|
||||
setTimeout(() => {
|
||||
let indexActive = buttons.findIndex((button, index) => {
|
||||
if (button.classList.contains('active')) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if(subject.children[indexActive].classList.contains('active')){
|
||||
return ;
|
||||
}
|
||||
|
||||
subject.querySelector('.remote-control__item.active').classList.remove('active');
|
||||
subject.children[indexActive].classList.add('active');
|
||||
|
||||
Reference in New Issue
Block a user