mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
feat: smaller tank icons
This commit is contained in:
1 parent
3c9fcfa623
commit
cc51f660d4
2 files changed
+10
-9
No files matched your search
@@ -17,14 +17,12 @@ export function useIntersection(
|
||||
const rect = ref.current.getBoundingClientRect();
|
||||
const visible = !(rect.bottom < 0 || rect.top - window.innerHeight >= 0);
|
||||
|
||||
if (visible) {
|
||||
callback();
|
||||
} else {
|
||||
observer.current = new IntersectionObserver(callback, options);
|
||||
observer.current.observe(ref.current);
|
||||
if (visible) callback();
|
||||
|
||||
return () => observer.current!.disconnect();
|
||||
}
|
||||
observer.current = new IntersectionObserver(callback, options);
|
||||
observer.current.observe(ref.current);
|
||||
|
||||
return () => observer.current!.disconnect();
|
||||
}, []);
|
||||
|
||||
return observer;
|
||||
|
||||
Reference in new issue
Block a user