Console Errors - Not a Jquery Guru Yet

Posted by user2528902 on Stack Overflow See other posts from Stack Overflow or by user2528902
Published on 2013-06-27T16:11:23Z Indexed on 2013/06/27 16:21 UTC
Read the original article Hit count: 237

Filed under:

I am hoping that someone can help me to correct some issues that I am having with a custom script. I took over the management of a site and there seems to be an issue with the following code:

/*  jQUERY CUSTOM FUNCTION 
------------------------------ */
jQuery(document).ready(function($) {
$('.ngg-gallery-thumbnail-box').mouseenter(function(){
   var elmID = "#"+this.id+" img";
   $(elmID).fadeOut(300);
});

$('.ngg-gallery-thumbnail-box').mouseleave(function(){
   var elmID = "#"+this.id+" img";
   $(elmID).fadeIn(300);
});

var numbers = $('.ngg-gallery-thumbnail-box').size();

function A(i){
    setInterval(function(){autoSlide(i)}, 7000);
}
A(0);

    function autoSlide(i) {
        var numbers = $('.ngg-gallery-thumbnail-box').size();
        var elmCls = $("#ref").attr("class");
        $(elmCls).fadeIn(300);
        var randNum = Math.floor((Math.random()*numbers)+1);
        var elmClass = ".elm"+randNum+" img";
        $("#ref").attr("class", elmClass);
        $(elmClass).fadeOut(300);
        setInterval(function(){arguments.callee.caller(randNum)}, 7000);
    }
});

The error that I am seeing in the console on Firebug is "TypeError: arguments.callee.caller is not a function. I am just getting started with jQuery and have no idea how to fix this issue.

Any assistance with altering the code so that it still works but doesn't throw up all of these errors (if I load the site and let it sit in my browser for 10 minutes I have over 10000 errors in the console) would be greatly appreciated!

© Stack Overflow or respective owner

Related posts about jQuery