document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.term-description-toggle').forEach(function (btn) {
btn.addEventListener('click', function () {
const wrapper = this.closest('.term-description-wrapper');
wrapper.classList.toggle('is-open');
this.textContent = wrapper.classList.contains('is-open')
? 'نمایش کمتر'
: 'نمایش بیشتر';
});
});
});
document.querySelectorAll('.term-description-wrapper').forEach(function (wrapper) {
const content = wrapper.querySelector('.term-description');
const button = wrapper.querySelector('.term-description-toggle');
if (content.scrollHeight <= 200) {
button.style.display = 'none';
content.style.maxHeight = 'none';
}
});