This commit is contained in:
Shusui MOYATANI
2023-06-06 19:40:50 +09:00
parent fd80c92b83
commit 188475427b
14 changed files with 331 additions and 131 deletions

View File

@@ -0,0 +1,20 @@
import { createSignal, onMount } from 'solid-js';
const useDetectOverflow = () => {
let elementRef: HTMLElement | undefined;
const [overflow, setOverflow] = createSignal(false);
const setElementRef = (el: HTMLElement) => {
elementRef = el;
};
onMount(() => {
if (elementRef != null) {
setOverflow(elementRef.scrollHeight > elementRef.clientHeight);
}
});
return { overflow, elementRef: setElementRef };
};
export default useDetectOverflow;