Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.animate() callback passes wrong object #35

Closed
SimonEast opened this issue Jun 15, 2011 · 3 comments
Closed

.animate() callback passes wrong object #35

SimonEast opened this issue Jun 15, 2011 · 3 comments

Comments

@SimonEast
Copy link

BRILLIANT work with this plugin. Love it!

But think I found a bug... This code works with the default jQuery animate() but fails with your version.

$('img').animate({left: '300px'}, 3000, function() {
    console.log(this);
    this.src = 'new_image.jpg';
});

In standard jQuery, this in the callback refers to the actual DOM object, whereas in your version it's the jQuery object, with the DOM object as array index [0].

It's relatively simple to work-around, but took me ages to figure out the cause of the problem. How hard is it to fix this?

Simon.

@SimonEast
Copy link
Author

It seems to fail in Chrome, but I think works as expected in IE 9. Which means it's probably related to the webkit-specific functions.

@benbarnett
Copy link
Owner

Good find! I'll have a look now, should be relatively easy to fix unless it has other knock on effects.

@benbarnett
Copy link
Owner

Just added a release, do you want to see if it works?

ggilder pushed a commit to ggilder/jQuery-Animate-Enhanced that referenced this issue Sep 26, 2011
ggilder pushed a commit to ggilder/jQuery-Animate-Enhanced that referenced this issue Sep 26, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants