You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • The difference is that you are not passing the id in as an argument to setInterval, but are defining it in a function that the callback (the function inside setInterval) has access to.

    In it's simplest form, not this:

    var idAnim;
    function f(){
        idAnim = setInterval(function(id){
          clearInterval(id);
        }, 100, idAnim);
    }
    

    but this:

    function f(){
        var idAnim = setInterval(function(){
          clearInterval(idAnim);
        }, 100);
    }
    

    I'm not quite sure what you're trying to do, but try starting with the code above and then modifying it to do what you want.

About

Avatar for Gordon @Gordon started