javascriptcallbackeffectscriptaculous

Callback function in .Move() of scriptaculous


I am trying to something like this.

new Effect.Move('moveee', { x: -150}, { afterFinish: function () { console.log(x); } });

But it is not working. Where is the wrong ??


Solution

  • The Effect.Move function accepts two parameters. You are passing in three. You need to move the afterFinish property and value to the second parameter, like so:

    new Effect.Move(
      'moveee', 
      {
        x: -150,
        afterFinish: function ()
        {
          console.log(x);
        }
      }
    );