Skip to content

Instantly share code, notes, and snippets.

@valdiney
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valdiney/8759721 to your computer and use it in GitHub Desktop.
Save valdiney/8759721 to your computer and use it in GitHub Desktop.
Script OnclickHere
///////////////////////////////////////////////////////
//
// Project: onclickHere
// author: Valdiney França
//
//////////////////////////////////////////////////////
function showAndCloseAreas() { /*...*/ }
showAndCloseAreas.prototype.showAndClose = function( area, button, captionButtonAfter, captionButtonBefore, classBefore, classAfter ) {
return button.onclick = function() {
if( area.style.display === 'none' ) {
area.style.display = 'block';
button.innerHTML = captionButtonBefore || '';
button.classList.add(classAfter) || '';
button.classList.remove(classBefore) || ''; // Retira a class de baixo...
return false;
}
else {
area.style.display = 'none';
button.innerHTML = captionButtonAfter || '';
button.classList.add(classBefore) || '';
button.classList.remove(classAfter) || ''; // Retira a class de cima...
return false;
}
} // end showAndClose...
} // end showAndCloseAreas...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment