Conflict with collapse/expand script
-
I use in thousands of pages of my website a script to expand/collapse contents and at the bottom I also have as a widget your newsletter subscription entry field.
When contents are expanded (via clicking on a button using a click event listener) the contents display properly but then when clicking to collapse what was expanded the pages scroll to the bottom to your email subscription entry field and a tooltip saying “Please fill out this field” pops up.
This behavior basically ruins the user experience on every single page where I have collapsible contents.
Any ideas as to how I can either disable the “required” to fill the field behavior or stop the conflict?The script I use for expand/collapse is this:
var coll = document.getElementsByClassName("collapsible"); var i; for (i = 0; i < coll.length; i++) { coll[i].addEventListener("click", function() { this.classList.toggle("active"); var collapsedcontent = this.nextElementSibling; if (collapsedcontent.style.maxHeight){ collapsedcontent.style.maxHeight = null; } else { collapsedcontent.style.maxHeight = collapsedcontent.scrollHeight + "px"; } }); }
- The topic ‘Conflict with collapse/expand script’ is closed to new replies.