Просмотр исходного кода

Fixed first strand button not working

Lee Morgan 6 лет назад
Родитель
Сommit
8c20da5e11
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      views/shared/controller.js

+ 8 - 5
views/shared/controller.js

@@ -17,6 +17,14 @@ class StrandSelector extends HTMLElement{
                 this.appendChild(selector);
             }
 
+            for(let button of this.querySelectorAll("button")){
+                button.onclick = ()=>{
+                    this.setAttribute("strand", button.strandName.slice(0, button.strandName.indexOf("Strand")));
+
+                    window[`${button.strandName.slice(0, button.strandName.indexOf("Strand"))}Obj`].display();
+                }
+            }
+
             strands[0].style.display = "flex";
         })
     }
@@ -36,11 +44,6 @@ class StrandSelector extends HTMLElement{
                 }else{
                     button.style.borderBottom = "none";
                     button.style.cursor = "pointer";
-                    button.onclick = ()=>{
-                        this.setAttribute("strand", button.strandName.slice(0, button.strandName.indexOf("Strand")));
-
-                        window[`${button.strandName.slice(0, button.strandName.indexOf("Strand"))}Obj`].display();
-                    }
                 }
             }
         })