Вот так попробуйте скрипт исправить, будет откат к стилям прописанным по умолчанию:
function _toConsumableArray(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length);
i < arr.length; i++) { arr2[i] = arr[i];
} return arr2;
}
else { return Array.from(arr); } }
window.addEventListener('load', function () {
allClass(0.4); // время transition
function allClass(transition) {
var question = [].slice.call(document.querySelectorAll('.question'), 0)
answer = [].slice.call(document.querySelectorAll('.answer'), 0)
arrayHeight = [];
var props = function props(el) {
return el.getBoundingClientRect();
};
[].concat(_toConsumableArray(question)).forEach(function (e, i) {
arrayHeight[i] = props(answer[i]).bottom - props(answer[i]).top + 10 + 'px';
answer[i].style.height = '0px';
setTimeout(function () {
return answer[i].style.transition = transition + 's';
}, 50);
e.addEventListener('click', function () {
[].concat(_toConsumableArray(answer)).forEach(function (e, i) {
answer[i].style.height = '0px';
question[i].style.backgroundColor = '#fff';
question[i].style.color = '#000';
});
if (props(answer[i]).height == 0) {
answer[i].style.height = arrayHeight[i];
question[i].style.backgroundColor = '#9e39a1';
question[i].style.color = '#fff';
}
else {
question[i].style.backgroundColor = '';
question[i].style.color = '';
};
});
});
}
}, false);