Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] jQuery conflict


  • Famous
    Participant

    @famous

    when calling
    jquery-1.7.1.min.js
    in the header the avatar cropping function will not work. I need to use jQuery, can someone tell me how I can use jquery-1.7.1.min.js and have the cropping function work?

    Thanks

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

  • Tammie Lister
    Moderator

    @karmatosed

    WordPress comes with jQuery rolled in so therefore does BuddyPress. You can see how to safely add scripts here: https://codex.wordpress.org/Function_Reference/wp_enqueue_script

    If the avatar cropping isn’t working though the first step would be to check and see if there are any plugin conflicts. Deactivate all plugins then if that doesn’t work set the theme to default to test. A link maybe to your site if that is possible could help track down something should the above not work.

    I’m going to be bold and say you never need to include a newer version of jQuery, especially as WordPress 3.4 has just been released two weeks ago with the latest version.


    Famous
    Participant

    @famous

    @karmatosed – has nothing to do with plugins, its the call in the header to jQuery

    @djpaul – when I remove the call from the header, jQuery stops working for me.

    I am using the code below in the header.


    $(document).ready(function(){

    $(“.slidingDiv1”).hide();
    $(“.show_hide1”).show();
    $(‘.show_hide1’).click(function(){
    $(“.slidingDiv1”).slideToggle();
    });

    thanks


    Famous
    Participant

    @famous

    So if anyone wants the answer to this question @karmatosed led me to https://codex.wordpress.org/Function_Reference/wp_enqueue_script, which has the solutions.

    Replace all instances of $ with jQuery.

    $=jQuery


    martinbeaulne
    Participant

    @martinbeaulne

    I am always amazed when people find that kind of obscure solutions…

    I would have searched for that answer all my life, I wouldnt’ve found it.

    I read the Famous’ last post, tried it, said to myself: « That will never work, too easy.. », and Boom ! Worked.

    Just changed the “$”, in the script, for “jQuery”, took out the call for the jquery .js file, and now the avatar cropping works like charm.

    Thanks-a-lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] jQuery conflict’ is closed to new replies.
Skip to toolbar