15 lines
565 B
JavaScript
15 lines
565 B
JavaScript
(function(){
|
|
var bio = document.getElementById('author-bio');
|
|
var btn = document.getElementById('bio-toggle');
|
|
if (!bio || !btn) return;
|
|
requestAnimationFrame(function() {
|
|
if (bio.scrollHeight > bio.clientHeight + 2) { btn.hidden = false; }
|
|
});
|
|
btn.addEventListener('click', function() {
|
|
var exp = btn.getAttribute('aria-expanded') === 'true';
|
|
bio.classList.toggle('bio-clamped', exp);
|
|
btn.textContent = exp ? 'plus' : 'moins';
|
|
btn.setAttribute('aria-expanded', exp ? 'false' : 'true');
|
|
});
|
|
})();
|