Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
svelte-intersection-observer
Advanced tools
Detect if an element is in the viewport using the Intersection Observer API
Detect if an element is in the viewport using the Intersection Observer API.
This module ships with TypeScript definitions.
Try it in the Svelte REPL.
yarn add -D svelte-intersection-observer
# OR
npm i -D svelte-intersection-observer
<script>
import IntersectionObserver from "svelte-intersection-observer";
let entry = {};
let element;
$: inView = entry.isIntersecting;
</script>
<header>
<strong>Scroll down.</strong>
<div>
Element in view?
<strong class="answer" class:inView>{inView ? 'Yes' : 'No'}</strong>
</div>
</header>
<IntersectionObserver {element} bind:entry>
<div class="element" bind:this="{element}">
{#if inView}
Element is in view
{/if}
</div>
</IntersectionObserver>
Property name | Description | Value |
---|---|---|
element | Element observed for intersection | HTMLElement |
root | Containing element | null or HTMLElement (default: null ) |
rootMargin | Offset of the containing element | string (default: "0px" ) |
threshold | Percentage of element to trigger an event | number between 0 and 1 (default: 0 ) |
intersecting | If the element is intersecting | boolean |
entry | Observed element metadata | IntersectionObserverEntry |
IntersectionObserverEntry
)0.3.0 - 2020-11-23
entry
as a reactive propFAQs
Detect if an element is in the viewport using the Intersection Observer API
The npm package svelte-intersection-observer receives a total of 2,060 weekly downloads. As such, svelte-intersection-observer popularity was classified as popular.
We found that svelte-intersection-observer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.