JSFiddle - React, Tailwind, and code Playground

by kiokotzu

HTML

<div class="luis"></div>
<div class="hola"></div>

CSS

.luis{height:100px; background:red;}
.hola{height:200px; margin:1000px 0 0 0; background:blue;}

JavaScript

$(window).scroll(function(event){
    
    var restar = $(this).height() - $('.hola').outerHeight()/2;
    
    var alto_total = $(this).scrollTop();
    var loader_business = $('.hola').offset().top - restar;
    
    console.log(alto_total + " == " + loader_business +'resta'+ restar);
    if(alto_total >= loader_business)
    alert('tomalo');
});