Animate pages
Hi guys,
I want pages to animate when you come to this part of the page.
For example container 1 insert from the right when you are on this part of the page.
Anybody who can help me with that.
https://codepen.io/Boeroe/pen/GRzQrKJ
2 Replies
you have to look at intersection observer.
ref: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
here a simple implementation
then, in css you can style the sections based on the [data-inview=false] atrribute.
if it is not in view, the section is translated of the screen. otherwise it will transition to it's original position
MDN Web Docs
Intersection Observer API - Web APIs | MDN
The Intersection Observer API provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.
Will look into this this weekend thanks