fix a minor click event issue on the tab pane
This commit is contained in:
parent
a332e77857
commit
cebda05598
@ -35,7 +35,7 @@
|
||||
<div class="installation">
|
||||
<h3 class="section__title">Installation</h3>
|
||||
<div class="tab__container">
|
||||
<ul>
|
||||
<ul class="tab__menu">
|
||||
<li class="tab active" data-tab="mac">mac</li>
|
||||
<li class="tab" data-tab="linux">linux</li>
|
||||
<li class="tab" data-tab="win">win</li>
|
||||
|
@ -59,6 +59,7 @@ hr {
|
||||
margin: 0;
|
||||
right: 1rem;
|
||||
top: -2rem;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.tab__container .code {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user