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

263
Vistas
Why wont this function work in JavaScript

I am working on a small project. The page is supposed to come in from being blurred, into a clear image. The problem is that the image never gets clear. It remains at the same level of blur (30Px). Everything else is now functioning properly.

Im not sure what else to add to the question.


CSS:

@import url('https://fonts.googleapis.com/css?family=Ubuntu');

* {
    box-sizing: border-box;
}

body {
    font-family: "Ubuntu", sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    margin: 0;  
}

.bg {
    background: url("4.jpg") no-repeat center center/cover;
    position: absolute;
    top: -300px;
    left: -30px;
    width: calc(100vw + 50px);
    height: calc(100vw + 30px);
    z-index: -1; 
    filter: blur(30px);
}


#text {
    font-size: 50px;
    color: #fff;
}

JS:


loadText = document.getElementById('text');
const bg = document.querySelector('.bg');

let load = 0;

const int = setInterval(blurring, 100);

function blurring() {
    load++
    console.log(load)
    if (load > 99) {
        clearInterval(int)
    }

    loadText.innerText = `${load}%`
    loadText.style.opacity = scale(load, 0, 100, 1, 0)

}

function scale (number, inMin, inMax, outMin, outMax) {
    return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}

blurring()


The image starts blurred, but never becomes clear. This count from 0% to 100% functions properly. The opacity fade is working properly as well. The only thing not functioning is the image becoming clear. 
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