Leonardo Valentin Zeferino
Posts: 0
Joined: Fri May 29, 2015 2:07 pm

Infinite Scroll: Uncaught ReferenceError: onScrollHandler is not defined

Hi,

I followed all the steps to deploy infinite scroll explained here (https://blog.appery.io/2015/07/how-to...) and works as expected. However, sometimes, I get the error in console log "Uncaught ReferenceError: onScrollHandler is not defined", exactly in the line "jQuery(window).scroll(onScrollHandler);":

code
var infiniteList = {
limit: "3",
skip: "0",
noMoreItems: undefined
};
Apperyio.storage.dogsInfinite.set(infiniteList);
console.log(infiniteList);

Code: Select all

             window.setTimeout(function() { 
                 jQuery(window).scroll(onScrollHandler); 
             }, 200); 

/code

Do you know why? I thought that the time 100ms wasn't enough and I changed to 200ms but the error was kept. The problem is I can't find a pattern to simulate and try to solve.

Could you help me, please?

Thanks.

suficiente
pensei

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Infinite Scroll: Uncaught ReferenceError: onScrollHandler is not defined

Hi Leonardo,

1 It seems your global "onScrollHandler" function is not defined.

You can try to replace "onScrollHandler" with "self.onScrollHandler" everywhere.

2 Also you need to check if you have JS asset with JS code described in part with title "Adding new JavaScript file". In this document: https://blog.appery.io/2015/07/how-to...

3 And last thing to check - errors on the page that could prevent some code to execute.

Regards.

Return to “Issues”