Created
December 28, 2016 08:36
-
-
Save nicco88/ec8fc7ea954b5c401b92592be2ab8e07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openExpTable(evt, tableName){ | |
var tabContent, tabLinks; | |
// get all elements with class="tab-content" and hide them | |
tabContent = document.getElementsByClassName("tab-content-exp"); | |
for (var i = 0; i < tabContent.length; i++) { | |
tabContent[i].style.display = "none"; | |
} | |
// get all elements with class="tab-links" and remove the class "active" | |
tabLinks = document.getElementsByClassName("tab-links-exp"); | |
for (var i = 0; i < tabLinks.length; i++) { | |
tabLinks[i].className = tabLinks[i].className.replace(" active", ""); | |
} | |
// show the current tab, and add an "active" class to the link that opened the tab | |
document.getElementById(tableName).style.display = "inline-block"; | |
evt.currentTarget.className += " active"; | |
} | |
/***** *****/ | |
function openRewTable(evt, tableName){ | |
var tabContent, tabLinks; | |
// get all elements with class="tab-content" and hide them | |
tabContent = document.getElementsByClassName("tab-content-rew"); | |
for (var i = 0; i < tabContent.length; i++) { | |
tabContent[i].style.display = "none"; | |
} | |
// get all elements with class="tab-links" and remove the class "active" | |
tabLinks = document.getElementsByClassName("tab-links-rew"); | |
for (var i = 0; i < tabLinks.length; i++) { | |
tabLinks[i].className = tabLinks[i].className.replace(" active", ""); | |
} | |
// show the current tab, and add an "active" class to the link that opened the tab | |
document.getElementById(tableName).style.display = "inline-block"; | |
evt.currentTarget.className += " active"; | |
} | |
/***** Mobile version******/ | |
// panel 1 | |
var btnPanel1 = document.getElementById("btnPanel1"); | |
var btnPanel1Expl = document.getElementById("btnPanel1Expl"); | |
var panel1 = document.getElementById("panel1"); | |
var panel1Expl = document.getElementById("panel1-expl"); | |
btnPanel1.classList.add("activeMob"); | |
btnPanel1Expl.addEventListener("click", function(){ | |
btnPanel1.classList.remove("activeMob"); | |
panel1.style.display = "none"; | |
panel1.classList.remove("in"); | |
panel1.className = | |
panel1.className.replace | |
( /(?:^|\s)in(?!\S)/g , '' ); | |
panel1Expl.style.display = ""; | |
if(btnPanel1Expl.classList.contains("activeMob")){ | |
btnPanel1Expl.classList.remove("activeMob"); | |
} else { | |
btnPanel1Expl.classList.add("activeMob"); | |
} | |
}); | |
btnPanel1.addEventListener("click", function(){ | |
btnPanel1Expl.classList.remove("activeMob"); | |
panel1Expl.style.display = "none"; | |
panel1Expl.classList.remove("in"); | |
panel1Expl.className = | |
panel1Expl.className.replace | |
( /(?:^|\s)in(?!\S)/g , '' ); | |
panel1.style.display = ""; | |
if(btnPanel1.classList.contains("activeMob")){ | |
btnPanel1.classList.remove("activeMob"); | |
} else { | |
btnPanel1.classList.add("activeMob"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment