Conflict with "propel"

  • olivier_s

    #1258

    Hi,

    Loading the jquery librairy direclty from the web with this funtion :

    function graphene_scrollable_js() {
    wp_enqueue_script('graphene-jquery-tools', 'http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js', array('jquery'), '', true);
    }

    looks override the last jquery version of “Propel” Plugin.

    But when I delete this function of Graphene, the slide appears broken (certainly normal).

    Do you know how to replace this call whitout break anything ?

    Thanks 🙂 !

    Admin

    Syahir Hakim

    #15034

    Is Propel using jQuery Tools library as well?

    The above code you quoted will load the jQuery Tools library, and will only load the jQuery library (needed by jQuery Tools) if it hasn’t been loaded yet. One of the main reasons of queueing scripts this way is to prevent conflicts caused by multiple loading of the same script library.

    olivier_s

    #15035

    In his “init()” function, propel use :

    Code:
    wp_enqueue_script(‘jquery’);

    It’s not the same name, so I try to change the name in function.php of Graphene

    function graphene_scrollable_js() {
    wp_enqueue_script('jquery', 'http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js', array('jquery'), '', true);
    }

    but.. it appears your theme and the propel plugin did’nt use the same version of jquery (1.4.4 for propel).

    So one of them can’t work 🙁

    Do you plan to change jquery version in a future update ?

    Admin

    Syahir Hakim

    #15036

    Erm…you’re treading on an unknown path here…

    Firstly, there’s the jQuery library. It is a huge library, providing a javascript framework that is both powerful and easy to use.

    And then there’s the jQuery Tools library, which is the library that provides the slider functionality.

    Here are the key points you need to realise:

    1. These are two different libraries.

    2. The jQuery Tools library requires the jQuery library in order to work.

    3. The jQuery library does not require the jQuery Tools library to work, but it provides the functionality that the jQuery Tools library needs.

    So as a result, both libraries need to be loaded in order for the slider to work.

    Changing the Graphene code like you did:

    function graphene_scrollable_js() {
    wp_enqueue_script('jquery', 'http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js', array('jquery'), '', true);
    }

    is wrong because you are telling WordPress that the jQuery Tools library is the jQuery library, which is wrong, and will probably break almost all scripts that depend on jQuery on your site.

    I’m beginning to suspect that Propel is at fault here because from what you mentioned, it seems like Propel is using a specific version of jQuery, perhaps loaded from somewhere else (Google AJAX CDN?).

    Graphene, on other hand, uses the jQuery library that comes bundled with WordPress. This is the way it should be done, because WordPress itself and a lot of other plugins are using the jQuery version that comes bundled with WordPress. Changing it to different version will break a lot of things.

    olivier_s

    #15037

    Thanks a lot for theses explanations ! 🙂

    So strange, because of the JS error generated is : “b is undefined”, and go to the jQuery Tools librairy, which is not used…! That’s why my misunderstanding.

    I will search another solution…

    Thanks !

Viewing 5 posts - 1 through 5 (of 5 total)

  • You must be logged in to reply to this topic.