The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery not responding once I move it to wordpress

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
  • #31355
    Rob MacKay

    Hey. Yea. It’s the way WordPress loads scripts to remove the problem of duplication and clashes between libraries.

    have a look here:

    or just wrap your jQuery in this document ready, instead of the default:

    jQuery(document).ready(function($) {


    Are you saying jQuery is not working? It is, I tested it.

    So I changed…

    $(function() {	


    jQuery(document).ready(function($) {

    but still not working.

    Rob MacKay


    If you have a read through the page I linked it might make a little more sense too :)

    and here too:


    Ok, it’s finally responding. But jQuery is not adding to the #mover.

    This is some craziness!


    I tried that. Not working.

    The jQuert is adding the distance to the list items, just not the #mover.


    I have been staring at this one for some time now. Checking the script from ‘DOM ready’, comparing the scripts (and CSS :-) ). But now I have found it!!!

    HTML 5 data- Attributes

    As of jQuery 1.4.3 HTML 5 data- attributes will be automatically pulled in to jQuery’s data object.

    You are including 1.4.2, so the ‘data-pos’ HTML attribute is ignored. So, either include a newer version of jquery or change:

    jQuery("#mover").css("left", -($"pos") * speed - 40));


    jQuery("#mover").css("left", -($el.attr("data-pos") * speed - 40));

    BTW You can use ‘$’ to reference jquery while inside the :

    jQuery(document).ready(function($) {

    I also don’t think you need to use the no-conflict mode of jquery. If you are still loading the script via the deregister/register scripting in the ‘function.php’, as it unloads WordPress’s warped version of jQuery (but leaves the original jQuery for admin pages!).

    I could be wrong, on all accounts – but I have learnt a few things while playing :-p


    Yeah, I had the same issue with this not working (although not on wordpress), you have to update to 1.4.3 in order for it to work


    Yes! Thanks Clokey! Good things will happen to you this week.

    I wonder why the following code pulls an older JQ library? Seems like it would pull the newest.


    I believe that links locally, you probably can just rip out that line and link straight to googles newest version and be fine. You should do that anyway.

    Rob MacKay

    It just links locally by default because WP comes “supplied” with a copy of jQuery.

    Shows how to pull it from the CDN :)


    I posted this in response to someone else recently (I thought it was you @aaronheine), and I referred to it earlier but didn’t link it:

    I use this script, it includes the deregistering of WP’s jQuery, pulling in the Google CDN version, and loading other plugins etc. The plugins loading based on dependancy aswell;

Viewing 12 posts - 1 through 12 (of 12 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.