WordPress.org

Ready to get started?Download WordPress

Forums

JQuery: Several plugins and custom scripts (1 post)

  1. romanczar
    Member
    Posted 4 years ago #

    HI,

    I would like to sue some JQuery functionality. I also had some JQuery plugins in use (JQuery Lazy Load, Slimbox2).

    When adding my custom JS files, non-WP-plugin JQuery plugin files, and JQuery code files to my header, all is loaded properly (according to firebug).

    BUT: e.g. the simple standard code

    $(document).ready(function($) ...

    throws a Firebug error stating that "$ is not a function". When I do

    wp_deregister_script( 'jquery' );
    wp_enqueue_script( 'jquery', get_bloginfo('template_url')."/js/jquery-1.4.2.min.js", array());

    all seems to work fine. But I am afraid I might break something like this...

    My questions are:

    1. How to best reuse scripts from WP? I know the

    wp_enqueue_script( 'jquery_scrollto', "/js/jquery.scrollTo.js", array('jquery'));

    method, but even that did not work 100% and the error remained. Only when deregistering the standard jquery.js and re-regitering a custom jquery.1.4.2.js it worked. Why?
    2. How to best queue scripts in the proper order?
    3. When to place cusom script files that e.g. contain Jquery statements?
    4. Is there a way to avoid plugins adding already added code? E.g. the Jqery library? Lazy load added a Google variant...

    THANKS for any ideas and help. I would love to have some bright minds discuss with me that topic.

Topic Closed

This topic has been closed to new replies.

About this Topic