Does IntersectionObserver support horizontal scrolling observation?

Viewed 2951

I made a couple of vertical scroll IntersectionObserver modules, but I'm interested in horizontal scroll (root will be a div and observation target will be an img). I want to observe the changes when the img becomes enlarged but the div remains the width of the viewport. I'm not even sure that mobile Safari will report a zoomed img as having a changed width, this is an experiment. Back to the question though, I haven't found any info. re: observing horizontal intersection so I'm not sure if that's supported?

1 Answers

To get an IntersectionObserver only in the x axis you can add to the options: rootMargin: "4000px 0px 4000px 0px".

Related