• Resolved Nick Lewis

    (@nickylew)


    Hi.

    Sorry to bombard with so many support requests!

    I have my JS file being loaded after all the other JS files for the Ajax load plugin and one of your function snippets in there to check when the Ajax is complete each time it runs.

    It returns as an Uncaught Type error: $(...) is not a function but then correctly runs and displays the Ajax Load More Complete! in the console.

    My code:

    $(document).on('ready', function() {
    
    	// loading animation and fade out
    	$('.things #wrapper .row .loading').delay(10000).fadeOut("slow");
    
    	//isotope masonry of blocks
    	$('#things-posts .alm-listing').isotope({
    		itemSelector: '.item',
    		layoutMode: 'masonry',
    		percentPosition: true,
    		masonry: {
    			columnWidth: 50
    		}
    	});
    
    }); //document ready
    
    $(function() {
    	$.fn.almComplete = function(alm){
    	  console.log("Ajax Load More Complete!");
    	};
    })(jQuery);

    Is there anything I’m doing wrong here? Or is there a different way to call the function so it doesn’t fail first then run okay after that?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    @nickylew No worries at all.
    You might as well move the

    $.fn.almComplete = function(alm){
        console.log("Ajax Load More Complete!");
    };

    function into your document.ready function since it is not throwing an error.

    For JS errors like this it would be much faster to first seasrch Google for this error – lots of results for this exact bug as well as found in the FAQ ??

    Thread Starter Nick Lewis

    (@nickylew)

    Researched and fixed the issue. Now have no errors.

    You’re right, I should have researched first before writing on here!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Callback functions ‘is not a function’ before running correctly’ is closed to new replies.