How to stop mobile safari from setting fixed positions to absolute on input focus?
Safari has supported position: fixed since at least version 9.2, but if you're seeing difficult issues, you can fully create the fixed position effect by making the document element and body full screen and then using absolute positioning. Scrolling then occurs in some main container element rather than the body. Your "fixed" elements can exist anywhere in the markup using this method.
jsfiddle here
html,
body,
.mainContainer {
height: 100%;
width: 100%;
overflow: hidden;
margin: 0;
}
.mainContainer {
overflow: auto;
}
.fixed {
position: absolute;
bottom: 20px;
left: 20px;
}
position: fixed doesn't work on iPad and iPhone
I ended up using the new jQuery Mobile v1.1: http://jquerymobile.com/blog/2012/04/13/announcing-jquery-mobile-1-1-0/
We now have a solid re-write that provides true fixed toolbars on the
a lot of popular platforms and safely falls back to static toolbar
positioning in other browsers.The coolest part about this approach is that, unlike JS-based
solutions that impose the unnatural scrolling physics across all
platforms, our scrolling feels 100% native because it is. This means
that scrolling feels right everywhere and works with touch, mousewheel
and keyboard user input. As a bonus, our CSS-based solution is super
lightweight and doesn’t impact compatibility or accessibility.
Related Topics
How to Properly Animate Uiscrollview Contentoffset
How Should a Swift + Objective-C Project Be Setup for Unit Testing
Reused Cells in a Uicollectionview Show Multiple Uiimageviews When They Should Only Show One
iOS Webaudio Only Works on Headphones
How to Check If Haptic Engine (Uifeedbackgenerator) Is Supported
How to Write Application Logs to File and Get Them
How to Represent Core Data Optional Scalars (Bool/Int/Double/Float) in Swift
How to Wait for a Function to End on iOS/Swift, Before Starting the Second One
Get Current iOS Device Orientation Even If Device's Orientation Locked
How to Have a Uiscrollview Scroll and Have a Gesture Recognizer
What Is Main Thread Checker in Xcode
How to Use Reusable Cells in Uitableview for iOS
Latitude and Longitude Points from Mkpolyline