Files
Gainsight/Custom_Templates/customer_templates/customcss.js

27 lines
812 B
JavaScript

window.addEventListener('load', function () {
const callback = function(mutationList, observer) {
if (
document.querySelectorAll(".transcriptToggle").length > 0 &&
document.querySelectorAll(".transcriptContent").length > 0
) {
var acc = document.getElementsByClassName("transcriptToggle")
toggleAccordions(acc)
}
function toggleAccordions(acc) {
var i
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function () {
this.classList.toggle("open")
var panel = this.nextElementSibling
if (panel.style.maxHeight) {
panel.style.maxHeight = null
} else {
panel.style.maxHeight = panel.scrollHeight + "px"
}
})
}
const observer = new MutationObserver(callback);
observer.observe(targetNode, config);
}}});