0

I have constructed a paradigm just to show you what kind of problem I'm facing.

Imagine you want to make a button appear every time the web page is scrolled to top (not scrolling upwards but when the web page has reached top) and you want the button to disappear the moment the user scrolls downwards.

Any reasonable man would think that by checking the scrollView.contentOffset.y you could get the scrolling state of the web page. If it's 0 then it's on top.

if (scrollView.contentOffset.y == 0) {

    // It's on top.
}

However, there are some pages where this method doesn't work. For example: http://www.apple.com/iphone-5s/

The contentOffset remains (0, 0) no matter how much you scroll downwards. I don't care about pages that aren't scrollable. I only care about pages that are scrollable but the contentOffset remains (0, 0) like the one above.

How do I solve this problem? Maybe using javascript? I'm out of ideas.

Vulkan
  • 1,004
  • 16
  • 44
  • It doesn't matter if the solution is in Objective-C or Javascript or any other language that works within the iPhone programming framework. I just thought that javascript is more likely to offer a solution, that's why i tagged it. It's both an Objective-C and Javascript problem. – Vulkan Jul 25 '14 at 20:00
  • How can I offer reputation? – Vulkan Jul 25 '14 at 20:06
  • Visit the help center to learn how to use the site: http://stackoverflow.com/help or take a tour: http://stackoverflow.com/tour – Sid Jul 25 '14 at 20:09

1 Answers1

0

You can use a library from jQuery named waypoint

jQuery(element.loc).waypoint

You can find more information on how to use it on the jQuery site