WordPress.org

Ready to get started?Download WordPress

Forums

WP jQuery Lightbox
[resolved] Broken with jQuery 1.10.0 (4 posts)

  1. carbeck
    Member
    Posted 1 year ago #

    This plugin has stopped working for me recently, the Javascript error console in Chrome returns the following output:

    Uncaught TypeError: Object [object Object] has no method 'live' jquery.lightbox.min.js:1
    a.fn.lightbox jquery.lightbox.min.js:1
    doLightBox jquery.lightbox.min.js:1
    c jquery-latest.min.js:4
    p.fireWith jquery-latest.min.js:4
    x.extend.ready jquery-latest.min.js:4
    q jquery-latest.min.js:4

    Neither Firefox nor Chrome will show any lightbox, instead, the user is sent to the URL of the image defined in the link, i.e. the rel="lightbox[…]" property doesn't trigger the lightbox to be shown. Deactivating recently-updated plugins hasn't made the lightbox work again either.

    jQuery: 1.10.0
    WP jQuery Lightbox: 1.4.1
    Wordpress: 3.5.1
    Theme: Twentyeleven 1.5
    Firefox: 21.0
    Chrome: 27.0.1453.93
    OS: Ubuntu 12.04.2

    EDIT: When I change WordPress to load jQuery 1.9.1 instead of 1.10.0, this plugin works. So it really must be jQuery 1.10.0 that's the culprit.

    http://wordpress.org/extend/plugins/wp-jquery-lightbox/

  2. carbeck
    Member
    Posted 1 year ago #

    That is, WP jQuery Lightbox should of course be fixed to be compatible with the current jQuery version of course, not the other way round.

    The jQuery API says that ".live()" has been deprecated since version 1.7 and was removed in version 1.9. Instead, you're supposed to use ".on()" now. Looking into the source code of the plugin, there's:

    if(parseFloat($().jquery) >= 1.7){
    	return $(this).on("click", onClick);
    }else{
    	return $(this).live("click", onClick); //deprecated since 1.7
    }

    However, with jQuery 1.10, the "else" condition kicks in, since parseFloat($().jquery) returns "1.1" in that case! Googling a little, I found this attempt at solving the version checking problem: http://stackoverflow.com/a/14540169

  3. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    Good catch, and thanks for digging up the stackoverflow link. I'll fix this when I'm back on the island. (eg: this weekend)

  4. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    Fixed in 1.4.5. Thanks for reporting.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic