As @Floyd said, scroll events will not fire (if you hide the iframe scroll bars), since your application is in the iframe inside Facebook.
You can determine the scroll position of users on the page (Facebook, not the application) so that it is not completely accurate if you do not take into account the title and the floating title) using FB.Canvas.getPageInfo
http://developers.facebook.com/docs /reference/javascript/FB.Canvas.getPageInfo/ , but you should poll this event when you want to check the scroll position of users so that you can set it using a timer with setInterval
.
I just created a plugin for this purpose to use it in one of my Facebook apps. To use it, you just do is enable the plugin after your window.fbAsyncInit function and before you upload the Facebook Javascript SDK.
You can subscribe to the Facebook event “scroll” or listen to the dom event “fb-scroll”, in which two parameters “topPercent” and “bottomPercent” will be passed, and then call your own functions based on the users scroll position.
https://github.com/kus/facebook-app-scroll-event
Example:
// Subscribe to custom Facebook event FB.Event.subscribe('scroll', function(topPercent, bottomPercent){ console.log('scroll', topPercent, bottomPercent); }); // Listen to dom event with jQuery jQuery(document).on('fb-scroll', function(evt, topPercent, bottomPercent){ if(bottomPercent == 100){ // load more content } });
source share