views:

212

answers:

2

Hey now!

I'm doing a project similar to Google Reader.

I'm using Infinite Scroll jQuery Plugin which works exactly as advertised when viewing the contents of the default selected category (in a scrollable div).

However when selecting another category (or folder in the case of Google Reader) and the contents of that category is loaded with ajax into the same div container as above (basically exactly like Google Reader) and scrolling down to page 2 the problems arise as it will move to whatever page was previously selected +1 instead of starting from the beginning when a new category is selected.

I think basically I need a way to reset the plugin when a new category is selected. Any help greatly appreciated.

A: 

If you have any specific issue, please provide that... we don't solve these high-level type of problems. Ok bye now.

Luca Matteis
A: 

I realize it was a very general question. I was hoping to find someone who had done something similar.

Anyway, this is probably not optimal but I solved it like this.

I added this function to the plugin that can be called from out side the plugin:

this.resetPlugin = function() {
  $(document).unbind('retrieve.infscr',kickOffAjax);
  props.currPage = 1;
};

I load the plugin like this

window.infinitescroll = $('#content').infinitescroll({usual settings});

Than I can reset it when another category is selected:

window.infinitescroll.resetPlugin();
Amything