My Blog List

Thursday, October 16, 2014

maintaining position in list when history back

Recently I was ordered that I have to change paging list way to infinite list, that mean I have to query with special key, not page number.

I have to think seriously, can I do this???

I searched other homepages if there are hompages that use this pattern.
Best homepage was Facebook to benchmark

Facebook show us topic in timeline and if scroll to bottom , ajax will get more data from the server.

but there are something that i should consider carefully. 
what is that???

for example, i choose one topic and go backpage, list page will refresh and position I last saw will be lost.
In other word, ajax loading data dosen't save homepage last state.

To solve this problem.
I Think step.

1. in my list page, call list data from the server using ajax.
2. I scroll some position.
3. I click some data.
  - I have to check scroll.x scroll.y and save in history.
4. detail page show
5. go back to list page
6. get the last scrollx, scroll.y from saved data 
   - ajax call againg
7. and scroll to last position.

this is what I think
I might be good to change what I'm now working on.

Test Script
1. History.js
2. Iscroll4 

No comments:

Post a Comment