From cebda05598d0245307356b3ec4a1b494bf22f6ce Mon Sep 17 00:00:00 2001 From: Amie Chen Date: Fri, 12 Jan 2018 19:01:36 -0800 Subject: [PATCH] fix a minor click event issue on the tab pane --- index.html | 2 +- scribbler-global.css | 1 + scribbler.js | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 1bf1b4b..a0b1c74 100755 --- a/index.html +++ b/index.html @@ -35,7 +35,7 @@

Installation

-
    +
    • mac
    • linux
    • win
    • diff --git a/scribbler-global.css b/scribbler-global.css index 68bdd7a..f7dca94 100755 --- a/scribbler-global.css +++ b/scribbler-global.css @@ -59,6 +59,7 @@ hr { margin: 0; right: 1rem; top: -2rem; + padding-left: 0; } .tab__container .code { diff --git a/scribbler.js b/scribbler.js index 88def0b..3673ade 100755 --- a/scribbler.js +++ b/scribbler.js @@ -41,12 +41,12 @@ window.addEventListener("load", function() { // bind click event to each tab container for (var i = 0; i < tabContainers.length; i++) { - tabContainers[i].addEventListener("click", tabClick); + get('.tab__menu', tabContainers[i]).addEventListener("click", tabClick); } // each click event is scoped to the tab_container function tabClick (event) { - var scope = event.currentTarget; + var scope = event.currentTarget.parentNode; var clickedTab = event.target; var tabs = getAll('.tab', scope); var panes = getAll('.tab__pane', scope); @@ -128,8 +128,8 @@ window.addEventListener('scroll', function () { }); // responsive navigation -var topNav = document.querySelector('.menu'); -var icon = document.querySelector('.toggle'); +var topNav = get('.menu'); +var icon = get('.toggle'); window.addEventListener('load', function(){ function showNav() {