Skip to content

Instantly share code, notes, and snippets.

@labster
Created November 21, 2013 21:38
Show Gist options
  • Save labster/7590156 to your computer and use it in GitHub Desktop.
Save labster/7590156 to your computer and use it in GitHub Desktop.
Needed for my SectionHide hack.
function toggleSection(toggleObj, id, showtext, hidetext) {
var e = document.getElementById('sectionblock'+id);
if(toggleObj.innerHTML == showtext) {
toggleObj.innerHTML = hidetext;
e.style.display = 'block';
}
else {
toggleObj.innerHTML = showtext;
e.style.display = 'none';
}
}
function toggleAllSections(toggleObj, showtext, hidetext, showall, hideall) {
if (toggleObj.innerHTML == hideall) {
$( ".hidelink" ).each( function (i, val) {
if (val.innerHTML == hidetext) {
val.onclick();
}
});
toggleObj.innerHTML = showall;
}
else {
$( ".hidelink" ).each( function (i, val) {
if (val.innerHTML == showtext) {
val.onclick();
}
});
toggleObj.innerHTML = hideall;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment