I am using the bootstrap affix component to give a fixed nav bar at the top of the page. This nav bar contains form elements. When a form element is clicked on (given focus) the body of the page scrolls to the top. Is there a way to override this behaviour to prevent the scrolling?
Preventing body scrolling to top in mobile Safari/iPad/iOS 8
1.2k views Asked by nickf At
3
To save someone else 4 hours+ trawling for answers I'll attempt to answer my own question.
There doesn't seem to be a solution for using form elements on a fixed div without jumping.
My solution was to change the markup to a bootstrap-style drop-down.
Original select form element markup:
Bootstrap style drop-down markup:
Created a plunker to demonstrate this: http://plnkr.co/hYTJ9l
https://github.com/takien/FakeSelect library that offers a quick solution by manipulating the rendered markup.