Comments (14)
I know this issue is closed, but thought I would post a follow up as this post is easily found in google.
You can make infinite-scroll work on the iPhone and It's a very simple "fix".
Instead of using..
<nav id="page_nav">
<a href="?p=[NEXT]"></a>
</nav>
You need to add something to the href. If the href is empty I don't believe iPhone/WebKit renders the link and therefor infinite scroll cannot find the next page. I use a simple "." but for a better example use..
<nav id="page_nav">
<a href="?p=[NEXT]">Next Page</a>
</nav>
from infinite-scroll.
Hmmm..
me neither!
i've never really added anything for mobile devices specifically..
maybe onscroll never fires? because doesnt it have this alternate universe where everything is the viewport and scrolling doesnt exist? hmmm
from infinite-scroll.
http://stackoverflow.com/questions/2863547/javascript-scroll-event-for-iphone-ipad
Looks like scroll events are sent but you have to use window.pageYOffset instead of $(node).scrollTop() to get the correct offset in iPhone case
(i too use both your plugins guys, but havent tested in iPhone)
from infinite-scroll.
Nice. thanks for the tip, andy.
from infinite-scroll.
andy, i saw you forked the repo..
do you wanna take a crack at adding this in? i wonder if we can do it without sniffing the UA for iphone, etc.
from infinite-scroll.
i can only test on android :(
fork is so i can test some stuff to deal with the "invisible footer problem"
from infinite-scroll.
I don't know if this is fixed yet or not, but I think jquery is properly normalizing the pageYOffset when you call scrollTop, you can see it in the offset.js file in the 1.4.2 tag around line 242.
http://github.com/jquery/jquery/blob/1.4.2/src/offset.js
What I think might be up is the calculation of when to fetch new content. If the document is smaller then the window, I don't think it ever loads, also if the document is only slightly larger then the window their can be a problem.
from infinite-scroll.
i've used the javascript events 'touchstart' and 'touchend' before and they work with iphone/ipad. maybe one way to handle apple's mobile devices would be to set up the manual trigger via a function bound to 'touchstart' and 'touchend'? i might run a test for this over the weekend.
from infinite-scroll.
iOS devices never trigger scroll event on window, as they don't 'scroll'. The full page is rendered and that image is then 'panned' to expose portions.
from infinite-scroll.
please excuse the really crude nature of this demo, but i have a rough version of this working. it's still (very) buggy as i made this in virtually no time at all.
screenr:
http://screenr.com/HnE
you can try it out on your mobile device at the address below. it relies on touch events, so legacy/non-touch phones won't work.
http://lukeshumard.com/misc/mobile-infscr/
in this example, there are 4 pages, with the titles being "article title", "article title 2", and so on. in the screenr, it pulls 3 then gives an error, which is the first bug described below.
here's the js...
http://pastebin.com/9Gtyt8np
bugs that need sorting with this...
-
the manual trigger is prone to firing multiple times if you jump to the (very) bottom of the page. i've tried to correct this by adding the timeout of 400ms, but maybe it needs longer for the "bounce" effect on some mobile devices.
-
the manual trigger fires if there is less than a certain amount of distance left in the document to go through. all mobile browsers are different, so it's impossible to have a single number that will cover all browsers. if there's some better logic to determine when to trigger the plugin, i'm all for it.
-
some event to use besides touchevents for mobile browsers that don't support it. http://www.quirksmode.org/mobile/tableTouch.html
from infinite-scroll.
i've been noticing more traffic on the mobile test in the above post, so i figured i should give an update.
even with the new debounced scroll event (v1.5.110408), this is still unreliable for scrolling. i think perhaps the best practice in this case is to unbind the plugin from the smartscroll event and manually fire the append via triggering retrieve.infscr
i'll work on a new demo for this soon.
from infinite-scroll.
Yeah, best way to handle this is definitely using a manual trigger instead of scrolling. The scroll event is, to say the least, tricky to get working universally when you bind a function to it. I was hoping smartscroll would have taken care of this, but it hasn't. If you want to make sure that this will work on whatever device(s) you're planning for, do a manual trigger.
Facebook does it, and it seems to work for them. Twitter has the slide thing for touch screens, but you could easily accomplish that with touchstart and touchend to determine position and fire the trigger then.
from infinite-scroll.
Adding worked for me:
bufferPx: 100
from infinite-scroll.
No proposed solution has worked thus far. Has anyone used a different technique and was succesful?
from infinite-scroll.
Related Issues (20)
- Learning html
- How can I parse the next/prev links of loaded pages? HOT 1
- standby function with sticky footer HOT 1
- infinite-scroll with websockets
- tile HOT 1
- Items shown and total items under view more button HOT 3
- Fackbook hack
- Infinite scroll + JSON
- Cloudflare mirage data-cfsrc lazy load conflict
- my tumblr theme's images not loading after page 1 (Safari only) - Infinite scroll & load more issue HOT 3
- Feature - Combination with Pagination - Load and Scroll to specific Page
- Page Link Issue
- Card Columns Not Working
- Web App For Iqama status
- Infinite-scroll and Joomla
- View Transitions
- Infinite Scroll + Masonry works only sometimes, sometimes it bugs HOT 1
- prefill loads data endlessly when container has display:none HOT 2
- Deprecating the unload event HOT 2
- Rating of a topic and infinite scroll HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infinite-scroll.