Created
June 10, 2018 22:14
-
-
Save andrefs/8d02928707491b3df16f93efb59b13e1 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
//IE Fix | |
if (typeof(NodeList.prototype.forEach)!==typeof(alert)) | |
{ | |
NodeList.prototype.forEach=Array.prototype.forEach; | |
} | |
function showContent(id){ | |
// get all .content elements | |
var allDivs = document.getElementsByClassName('content'); | |
// add .hidden class to all .content elements | |
for(var i=0; i< allDivs.length; i++){ | |
allDivs[i].classList.add('hidden'); | |
} | |
// get element to show | |
var div = document.getElementById(id); | |
// remove .hidden class | |
div.classList.remove('hidden'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment