vendredi 23 décembre 2016

Unclosed element

I'm getting this error:

Error: Unclosed element `container.style.display` (on line 25). 

Line 25 of my program is:

if ((container.style.opacity -= .01) <= 0)

But I think it's referring to the line below:

container.style.display = "none";

Why am I getting this error?

The context:

<script>
var container = document.getElementById('popUpContainer');

function popUpFadeOut() {
    if (container.style.opacity == 0) {
        container.style.opacity = 1;
        container.style.display = "block";

        var fading = function fade() {

            if ((container.style.opacity -= .01) <= 0) {
                container.style.display = "none";
                container.style.opacity = 0;
            } else {
                requestAnimationFrame(fade);
            }
        };

        setTimeout(fading, 1000); //popup box fades away after 1 seconds
    }
};
</script>




Aucun commentaire:

Enregistrer un commentaire