Either reference to element or id as string. The element that is used as the viewport for checking visibility of the target. Must be the ancestor of the target.
false
options.rootMargin
string
0px
Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). MDN
false
options.fineness
number
100
Based on fineness an array for options.thresholdis generated, see examples below
false
options.threshold
number | number[]
[0, 0.01, 0.02, 0.03, ..., 0.97, 0.98, 0.99, 1]
Overwrites fineness if provided. Either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be executed. MDN
Tracked items will be wrapped in a div with the provided idstylable via .svelte-intersection-tracker-item
true
group
number
0
By defining groups items can be watched seperately e.g. for tracking subsections
false
let:props
Type
Default
Description
let:isIntersecting
boolean
false
Is true if the target element intersects with the intersection observer's root
let:percentage
number
0
Value between 0 and 1 representing the higher value of either the visible percentage of the elements area or the percentage the element is taking up of the viewport0.2 => Either 20% of element visible or element fills 20% of viewport
let:current
boolean
false
True if element has highest percentage in own group. May be true for multiple elements if they share the same percentage, e.g. 1 when 100% visible.