Skip to content

Instantly share code, notes, and snippets.

@conormcafee
Last active September 18, 2015 08:23
Show Gist options
  • Save conormcafee/dc2b79fa48ae4d52a104 to your computer and use it in GitHub Desktop.
Save conormcafee/dc2b79fa48ae4d52a104 to your computer and use it in GitHub Desktop.
Apollo Add/Remove
btn.addEventListener('click', function (e) {
apollo.toggleClass(divTest, 'is-hidden is-visible');
}, false);
document.getElementById('btn').addEventListener('click', function (e) {
apollo.toggleClass(document.getElementById('divTest'), 'is-hidden is-visible');
}, false);
// Class Name Multiple
document.getElementById('case-study-btn').addEventListener('click', function (e) {
var x = document.getElementsByClassName('name');
for (var i = 0; i < x.length; i++)
apollo.toggleClass(x[i], 'is-hidden is-visible');
}, false);
// Data Attribute Multiple
document.getElementById('case-study-btn').addEventListener('click', function (e) {
var x = document.querySelectorAll('[data-name="name"]');
for (var i = 0; i < x.length; i++)
apollo.toggleClass(x[i], 'is-hidden is-visible');
}, false);
@conormcafee
Copy link
Author

/* Homework*/

document.getElementById('case-study-btn').addEventListener('click', function (e) {
apollo.toggleClass(e.target, 'js-active js-inactive');
//
var y = document.querySelectorAll('[data-post="case-study"]');
for (var i = 0; i < y.length; i++)
apollo.toggleClass(y[i], 'is-hidden is-visible');
}, false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment