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

jQuery 1.8+ : Update doc for the callback example #126

Open
crtlf opened this issue Sep 30, 2016 · 1 comment
Open

jQuery 1.8+ : Update doc for the callback example #126

crtlf opened this issue Sep 30, 2016 · 1 comment

Comments

@crtlf
Copy link

crtlf commented Sep 30, 2016

When trying the callback example :

$("img").unveil(200, function() {
  $(this).load(function() {
    this.style.opacity = 1;
  });
});

... I just had the following error : Uncaught TypeError: a.indexOf is not a function

From the jQuery blog :

.load, .unload, and .error, deprecated since jQuery 1.8, are no more. Use .on() to register listeners.

So, if you just came across this error, you'll have to change the load function call to :

$(this).on('load', function() { ... });

It could be nice to update the documentation :)
More info here : http://stackoverflow.com/questions/37738732/jquery-3-0-url-indexof-error

@tzws
Copy link

tzws commented Jun 1, 2017

Hi,
I think the js should be:

$("img").unveil(200, function() {
    $(this).load(function() {
        this.style.opacity = 1;
    })
});

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