Minor changes to toggling

master
Addy Osmani 2014-06-19 14:56:27 +01:00
parent 951c1fe1ab
commit 0cecead44b
1 changed files with 7 additions and 4 deletions

View File

@ -1165,16 +1165,19 @@
'use strict';
var snippetToggle = document.querySelector('#snippet-toggle');
var snippets;
snippetToggle.addEventListener('click', function() {
var snippets = document.querySelectorAll('.auto-gen-code-snippet');
for(var i = 0; i < snippets.length; i++) {
snippets[i].classList.toggle('auto-gen-code-visible');
};
if(snippets){
for(var i = 0; i < snippets.length; i++) {
snippets[i].classList.toggle('auto-gen-code-visible');
};
}
}, true);
window.onload = function() {
createCodeSamples();
snippets = document.querySelectorAll('.auto-gen-code-snippet');
}
function createCodeSamples() {