unveil icon indicating copy to clipboard operation
unveil copied to clipboard

jQuery 1.8+ : Update doc for the callback example

Open crtlf opened this issue 8 years ago • 1 comments

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

crtlf avatar Sep 30 '16 09:09 crtlf

Hi, I think the js should be:

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

tzws avatar Jun 01 '17 03:06 tzws