Last active
August 29, 2015 13:55
-
-
Save valdiney/8759721 to your computer and use it in GitHub Desktop.
Script OnclickHere
This file contains 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
/////////////////////////////////////////////////////// | |
// | |
// 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