mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 04:06:17 +02:00
refactor: work with different line-clamp values
This commit is contained in:
@@ -117,7 +117,18 @@ define('forum/category', [
|
||||
function handleDescription() {
|
||||
const fadeEl = $(`.description[class*="clamp-fade-"]`);
|
||||
fadeEl.on('click', function () {
|
||||
fadeEl.toggleClass('line-clamp-4');
|
||||
const $this = $(this);
|
||||
let clampClass = $this.data('clampClass');
|
||||
if (!clampClass) {
|
||||
const match = $this.attr('class').match(/line-clamp-(\S+)/);
|
||||
if (match && match[1]) {
|
||||
clampClass = `line-clamp-${match[1]}`;
|
||||
fadeEl.data('clampClass', clampClass);
|
||||
}
|
||||
}
|
||||
if (clampClass) {
|
||||
fadeEl.toggleClass(clampClass);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user