JSFiddle - React, Tailwind, and code Playground

by 규연 황

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
<div class="box5"></div>

CSS

html, body {
  height: 100%;  
  position: relative;
}

div {
  height: 500px;
}
div:nth-child(odd) {
  background: red;
}

JavaScript

var $box2 = $('.box2');

$(window).scroll(function(){
	setInterval(function(){
  	$pos = $box2.offset();
  }, 0)
	
  
  console.log($('.box3').offset().top);
  if($pos < 0){
  	console.log('pp');
  }
	/* $('div').each(function(index){
	    console.log(index);
	  }) */
})

console.log('ok2');