Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
Flickering on scroll when section is visible

I have a problem with my code when the section is visible, there's a flickering happening on the frontend. The elements inside that section are flickering when on viewpoint. Here's my Jquery Code:

jQuery( document ).ready(function($) {


$(window).scroll(function() {
    var windowBottom = $(this).scrollTop() + $(this).innerHeight();
        var window_height = $(window).height(); 
            var scrollMiddle = $(window).scrollTop() + (window_height/2);
  
$(window).scroll(function() {
    
    $(".fading-section").each(function() {
        var classes = $(this).attr("class").split(/\s+/);
        var objectBottom = $(this).offset().top + $(this).outerHeight();
        var objectTop = $(this).position().top;
        var section_bg = $(this).find(".uagb-section__overlay").css("background-color");
        
        
        if (scrollMiddle >= objectTop && scrollMiddle <= objectBottom) { //object comes into view (scrolling down)
            
            
                $("body.page-id-2899").stop(false,false).animate({ backgroundColor: section_bg}, 750);
                $(this).addClass('visible-section');
                $(this).removeClass('notvisible-section');
                
            
        } else {
                $(this).removeClass('visible-section');
                $(this).addClass('notvisible-section');
                
            
        }
        
        
        //console.log(classes);
        //console.log(section_bg);
        //console.log("Object Top:" + objectTop);
        //console.log("Object Bottom:" + objectBottom);
        //console.log("The Middle:" + scrollMiddle);
        //console.log("Height of the screen:" + window_height);
    });
});  

 }); //invoke scroll-handler on page-load
});

This code will just set the opacity to 1 when I add the class on that section.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda