<div class="mainsite">
		<div class="para">
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolor culpa quibusdam maiores, aliquid, quia dicta sunt delectus modi inventore autem sed tenetur iste expedita soluta dolorem dolorum? Fugit id, minima.</p>
			<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores eum in, provident mollitia delectus voluptatem labore nobis necessitatibus aliquid aut quis sunt porro veniam rerum vel error. Possimus, pariatur, culpa.</p>
			<p>Lorem, ipsum dolor sit amet, consectetur adipisicing elit. Ratione doloribus quis dicta, in molestias suscipit delectus id eaque laborum nulla voluptatem nemo, optio, incidunt atque odio quae, quo laboriosam non?</p>
			<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Optio delectus obcaecati commodi, cumque, deserunt recusandae temporibus iusto fugit illo, minus, culpa asperiores? Voluptatum voluptatem maiores mollitia corrupti fuga ipsum explicabo?</p>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repudiandae reiciendis corporis vitae esse voluptatibus labore in consequuntur. Laborum dolores possimus delectus, debitis neque beatae et. Accusantium, quidem omnis laudantium necessitatibus?</p>
			<p>Lorem ipsum dolor, sit, amet consectetur adipisicing elit. Alias vel tenetur reprehenderit assumenda, dicta voluptatibus delectus reiciendis, explicabo omnis quas, incidunt et quisquam eos, amet quia dolores recusandae excepturi praesentium.</p>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur dignissimos consequuntur harum rem. Magnam repellat nam maxime facere accusantium eum alias nulla quos, ab eligendi sunt, fuga odit tenetur, ducimus.</p>
			<p>Lorem ipsum, dolor, sit amet consectetur adipisicing elit. Reprehenderit natus quam vitae dicta laudantium officia esse, recusandae deleniti perferendis dolorum eveniet, error dignissimos ut voluptates, minus a quia, architecto suscipit.</p>
			<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Harum, modi. Laboriosam temporibus est quasi odit harum repellendus eius odio saepe delectus vitae, porro doloribus aliquid consectetur sunt dignissimos unde. Exercitationem.</p>
			<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Placeat, consequuntur, nostrum. Numquam earum quis quaerat nulla accusantium nam neque quae quas, recusandae ea maxime accusamus nesciunt alias, expedita, molestiae enim!</p>
			<div class="mol"></div>
		</div>
	</div>
@import url('https://fonts.googleapis.com/css2?family=Julee&family=Lato:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&display=swap');
@import url('https://fonts.googleapis.com/css?family=PT+Sans');
@import url('https://fonts.googleapis.com/css?family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i');
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,200;0,400;0,600;0,700;0,900;1,400;1,600;1,700;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Courgette&family=Great+Vibes&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Courgette&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Julee&display=swap');



html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Lato', sans-serif;
  color: var(--hncolor);
}

* {
  box-sizing: border-box;
}

ul, p, b {
  margin:0;
  padding:0;
}


h1, h2, h3, h4, h5, h6 {
  /*font-family: 'Lato', sans-serif;*/
  font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
  margin:0;
  font-weight: normal;
  color: var(--hcolor);
}

h1 {
  font-size: 5rem;
  line-height: 4.5rem;
}
h2 {
  font-size: 3.5rem;
}
h3 {
  font-size: 2.5rem;
}

a {
  /*font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;*/
  font-family: 'Source Sans Pro', sans-serif;
}
p {
  font-size: 1.363rem;
  /*font-family: 'Lato', sans-serif;*/
  line-height: 1.475em;
  color: var(--hcolor);
  font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
}
.para {
  display: flex;
  flex-direction: column;
  gap: 80px;
  margin: auto;
  max-width: 700px;
}
.mainsite p {
  display: block;
  transform: translateX(-100%);
  transition: transform 1s;
}
.mainsite p.active {
  transform: translateX(0);
}
.mol {
  padding: 100px;
  margin-bottom: auto;
  background-color: green;
  transition: margin-bottom 5s, background-color 3s;
}
.mol.active {
  margin-bottom: 100px;
  background-color: red;
}
let options= {};

function callbackFunction(entries) { // array of observing elements
    entries.forEach(entry=> {
        if (entry.isIntersecting) {
            console.log("Yes");
            entry.target.classList.toggle('active');
        }
    })
}

let observer= new IntersectionObserver(callbackFunction,options);
document.querySelectorAll(".mainsite p").forEach(entry =>{
    observer.observe(entry);
});


function callBackFunction2 (entries) {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
        console.log("Yes Green");
      entry.target.classList.toggle('active')
    }
  })
}
let observer2 = new IntersectionObserver(callBackFunction2,options);
const mol = document.querySelector('.mol');
observer2.observe(mol);
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.