5

I am having issues with position: fixed; on IOS8 Safari. I've determined it's related to the footer div which I am positioning at the bottom of the page. I've also tried position: absolute; but that didn't work either.

Does anyone know of a way to position this without using CSS position?

Here is the code I'm using:

.foot-nav{
  position: fixed;
  bottom: 0;
  width: 100%;
}
Clinton Green
  • 9,697
  • 21
  • 68
  • 103

2 Answers2

11

You should try position:sticky;. It's made to deal with position on Safari. fixed has been an issue with mobile devices for years. I thought it was fixed but iOs8 has weird behavior too...

http://updates.html5rocks.com/2012/08/Stick-your-landings-position-sticky-lands-in-WebKit

Jason Lydon
  • 7,074
  • 1
  • 35
  • 43
5

iOS has issues with fixed positioning. When swiping to scroll, it will not update the fixed position until the tap/drag is released.

While position: fixed; technically works, mobile Safari does not redraw the fixed element while the scroll is happening in order to properly calculate the over-scroll animation (dragging and releasing causes the page to keep scrolling based on the speed of the swipe), so it won't update until the animation has stopped.

You could, theoretically, use JavaScript to manually update the element's position a bunch of times while dragging occurs, but that will override the default, natural behavior of mobile Safari.

More reading material and examples, if you're interested: http://remysharp.com/2012/05/24/issues-with-position-fixed-scrolling-on-ios

jeffjenx
  • 17,041
  • 6
  • 57
  • 99
  • I did see that article but thanks for the explanation. I'm still holding out to see if anyone has any bright ideas on positioning but if that doesn't happen I'll accept your answer. Cheers – Clinton Green Oct 01 '14 at 03:29
  • 2
    The way jQuery mobile does it is by putting the non-fixed content inside of a scrollable div that would extend from the top of the window down to the bottom of the page minus the height of the fixed content. Other than that, JavaScript polling of the scroll event is the only option, but even if you were to rewrite the drag/release slide effect (I tried), preventing the default scroll event will also stop the rubber-band over scroll, which cannot be re-emulated in JavaScript alone. – jeffjenx Oct 01 '14 at 03:46
  • I couldn't find a way to solve my issue but this answer explains why the issue is happening. Thanks – Clinton Green Oct 02 '14 at 01:17
  • I eventually found the cause and did not have to bother with positioning. IOS8 Safari cannot handle transitions anymore, that was causing all the problems. Removed them and it works. – Clinton Green Oct 09 '14 at 03:01