Forums

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

Home Forums JavaScript jQuery plugin on wordpress

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28067
    fiunchinho
    Member

    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.

    #171113
    basha136
    Participant

    hi did you get any solution

    #171115
    Alen
    Participant

    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.