Grow your CSS skills. Land your dream job.

jQuery plugin on wordpress

  • # February 18, 2010 at 5:12 pm

    Hi everybody!

    I was trying to use the idleTimer plugin on wordpress ( http://paulirish.com/2009/jquery-idletimer-plugin/ ) , but it keeps telling me that "idleTimer is not a function".

    The JS file is being loaded at the header,right after the jquery file, I can see that. I think it has to be a problem with the jQuery scope, which is kind of weird in WordPress. But I’ve tried every possible solution that I found on the internet, and none worked.

    I’ve tried using var $ = jQuery.noConflict(); and then

    Code:
    (function($){

    $(document).bind(“idle.idleTimer”, function(){

    });

    $(document).bind(“active.idleTimer”, function(){

    }).trigger(‘active.idleTimer’);

    $.idleTimer(5000);

    })(jQuery);

    but it doesnt work. Maybe I have to change the plugin file?
    The plugin file defines the function like

    Code:
    (function($){

    $.idleTimer = function f(newTimeout){
    // Stuff

    }; // end of $.idleTimer()

    })(jQuery);

    Any ideas? Thank you.

    # May 26, 2014 at 10:59 pm

    hi did you get any solution

    # May 27, 2014 at 12:30 am

    You’re calling the function before it’s defined. Make sure the plugin is loaded first before calling it.

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".