There's a billion scroll to's in this file. I'm trying to stop it from forcing you to the top every time the page changes. I even disabled the scroll to after the comment that says "Scroll to top, hide addr bar" but it hasn't stopped it. It's annoying to scroll down while the page is loading and then be forced back to the top when it completes loading. Anyone know what in there needs to be commented out?
Related
I have a button in bottom part of my website. On ios devices in safari browser, when i try to click it, it first opens footer section of browser and then i have to tap again to click the button. How can i click button in one tap?
Refer this GIF: https://i.stack.imgur.com/HyciL.gif
height: 100vh (this will set your content to have maximum possible height)
overflow-y: scroll (this will make that div/element scrollable and hence browser won't notice that you are scrolling when actually you are scrolling.)
Due to ios safari's default behaviour when you scroll on page it automatically hides header and footer of browser. Now if you have a button on bottom part of your website, you will have to tap twice to make it work. The first tap will trigger safari footer section (assuming you wanted to open footer section) and second tap will actually trigger click event on button.
One of main reason of this thing causing an issue is, whenever you scroll, safari notices that you have scrolled and you will keep scrolling. To show you maximum content on website it hides footer and addressbar. and that's why using overflow-y: scroll is mandatory.
P.S.
Because you are now scrolling within the div/element window.addEventListener('scroll', function()) won't work anymore. To fix that, you can use document.getElementById('your-div-id').addEventListener('scroll', function())
Apart from this window.pageYoffset will always be 0. To get pageYOffset, you can use getBoundingRect property of the div on which overflow-y:scroll was added.
For example:scrollPosition = document.getElementById('your-div-id').getBoundingClientRect().top
This will give you height from top of the div till you have scrolled.
Happy debugging
As it can be seen in the gif from the link, I was able to add the refresh control to the scrollView but it is only shown for the first page. It still works for the other pages but it is not showing the refresh indicator which might be confusing for the user.
I have tried already a couple of ideas but nothing seems to work.
I am looking for a solution, which either only makes it possible to use the refresh control on the first page and disables vertical scrolling for the other pages or a solution which shows the refresh indicator at every page.
I would also like to disable the diagonal dragging. I added this in case there is a solution which solves both problems.
https://giphy.com/gifs/KfqJnVlwKE9fwFc07R/html5
Help will be very appreciated.
The indicator looks like it is probably added as a child of the scrollview, meaning it is scrolled along with the other contained views, and hence scrolled off-screen.
For an element you want to always be displayed over the scroll view add the indicator as a sibling of the scroll view (i.e. a subview of the scroll view's parent).
I have Paged UIScrollVIew with 5 pages.
I have a problem where when I tap a button, I need to navigate from the 1st to 4th page. The problem is that it will show page 2 & 3 during this transition. I just want it to scroll to page 4 as if it were the next page in the scroll view.
Here is a diagram:
Any idea's on how to achieve this?
I think you'll have to reposition your pages within the scroll view to make that happen seamlessly. It probably means keeping track of what pages you've moved and perhaps a state engine that restores your original positions when you leave. It would probably be easier to make each page a subview and add that to your scroller, then you need just change each subviews frame as needed.
I've scoured through several questions asking about how to prevent scrolling when selecting a first responder however nothing I find seems to work for this issue.
I have a UITextField above my table view at the very top of my page. When the user selects it (or when I do it programmatically) it drops down a bit, seemingly giving room for options such as "paste" or autocorrect (which I've disabled). I'd like to prevent this from happening.
I've tried setting the scroll position myself, which it initially does, but then it instantly jumps down a bit. Is there a way I can make the paste/edit bubble appear below the textfield (like it does with textfields in the header)? I'm thinking perhaps that will prevent it from jumping downwards, but I can't find information on this.
I'm completely stuck so any help is appreciated. Links, vague suggestions, whatever. Thank you.
Try embedding your text field in a scroll view the same size as your text field.
The reason why this should work is because when a text field becomes first responder, it only scrolls the scroll view that is its most recent ancestor in the view hierarchy. If it only finds the dummy scroll view, whose content size should not exceed its bounds size, then no scrolling should occur in either scroll view.
When I load the page, my scrollview works perfectly, but when I navigate away from the main page and I try to return to it, the scrollview forgets where the top of the scrollview ought to be. It thinks that the place that I left the scrollview at before navigating away is the top of the list, and it thinks that the bottom of the list is somewhere beyond where the bottom actually is, thus it allows the user to scroll to far and then the scrollview disappears and cant be recovered unless i call scrollTo in the console.
I have tried doing scrollTo(0,0) on pagehide and beforepagehide with no luck -- the page will begin at the top when its shown, but it will immediately scroll down.
Here's how to reproduce the issue:
1) Go to http://7.latest.foodtrucksmap.appspot.com/m/la
2) Scroll down the list and select the detail disclosure on one of the cells.
3) Hit the 'Map' icon in the header to return to the original view.
At this point the scrollview will be in the state I've described.
Thanks a lot for the assistance in getting this resolved.
I resolved this by calling $('#list_content').scrollTop(0) on pageshow