Created
December 23, 2016 08:45
-
-
Save nicco88/81a4e30b5298291d99f4236d8deb78ff to your computer and use it in GitHub Desktop.
Arrow toggle
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
// Toggle panel-title arrow script | |
arrowToggle(); | |
function arrowToggle() { | |
var panelTitle = document.getElementsByClassName("panel-title"); | |
var arrowDown = "arrow_drop_down"; | |
var arrowUp = "arrow_drop_up"; | |
for(var i = 0; i < panelTitle.length; i++) { | |
panelTitle[i].addEventListener("click", function() { | |
if(this.getElementsByClassName("arrow")[0].innerHTML === arrowDown) { | |
this.getElementsByClassName("arrow")[0].innerHTML = arrowUp; | |
} else if (this.getElementsByClassName("arrow")[0].innerHTML === arrowUp) { | |
this.getElementsByClassName("arrow")[0].innerHTML = arrowDown; | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment