0

I want to add a class to an image if it has a specific class in a callback function. After adding the class the other should be removed.

http://dinbror.dk/blog/blazy/#Callback

;(function() {
    var bLazy = new Blazy({
    success: function(ele){
        console.log(ele);
        if $(ele).hasClass("gojarallax") {
            $(ele).addClass("jarallax");
            $(ele).removeClass("gojarallax");
            $('.jarallax').jarallax();
        }
    },
    src: 'data-blazy',
    });
})();

This is what i have. But it don“t work. I get the error:

Uncaught SyntaxError: Unexpected identifier

What am i doing wrong?

1 Answers1

0

Oh man..... After hours.... So stupid.....

    if ($(ele).hasClass("gojarallax")) {
         $(ele).addClass("jarallax");
         $(ele).removeClass("gojarallax");
         $('.jarallax').jarallax();
    }