Search:: how to check if html element is in ellipsis
HTML text-overflow ellipsis detection
Try this JS function, passing the span element as argument:
function isEllipsisActive(e) {
return (e.offsetWidth < e.scrollWidth);
}
@NicolasS.Xu I believe if the element is a span, you might get zeros in these properties. So one solution is to wrap the span in a div which has overflow: hidden and then check div properties instead. – Groo Oct 4, 2022 at 12:30
'✘✘✘ Javascript' 카테고리의 다른 글
Javascript Falsy values 값들 (0) | 2023.04.09 |
---|---|
[event] window.matchMedia - mobile detecting: 모바일 확인 하기 + React Hook (0) | 2023.04.06 |
Capitalize first letter (0) | 2023.01.09 |
[Javascript] Promise.allSettled vs Promise.all, Promise (0) | 2023.01.07 |
[javascript] Promise vs setTimeout:: why Promise resolved first? (0) | 2023.01.07 |
댓글