DVV,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
document.addEventListener("DOMContentLoaded", accordeon);
function accordeon() {
var accordTitles = document.querySelectorAll(".accordTitles");
var accordBlocks = document.querySelectorAll(".accordBlocks");
var index;
function closeBlocks(i) {
accordTitles[i].style.color = "black";
accordBlocks[i].style.display = "none"
}
function openBlocks(i) {
accordTitles[i].style.color = "#fa05f6";
accordBlocks[i].style.display = "block";
}
[].forEach.call(accordTitles, function(btn, i) {
closeBlocks(i);
btn.addEventListener("click", function() {
if (index !== i) openBlocks(i);
if (index !== void 0) closeBlocks(index);
index = index !== i ? i : void 0
})
})
};
</script>
</head>
<body>
<div class="accordTitles">1</div>
<div class="accordTitles">2</div>
<div class="accordTitles">3</div>
<div class="accordTitles">4</div>
<div class="accordTitles">5</div>
<div class="accordBlocks">1</div>
<div class="accordBlocks">2</div>
<div class="accordBlocks">3</div>
<div class="accordBlocks">4</div>
<div class="accordBlocks">5</div>
</body>
</html>