I'm developing a webapp开发者_JS百科 using jQuery Mobile. One thing I want to do is to display some auto-complete suggestions for certain input fields. I want the block with those suggestions to appear as if it extends the onscreen keyboard, resting exactly on its top edge and staying there when I scroll the page.
A quick and dirty illustraion:
I see similar sort of things being done in some native apps. Is there a way to achieve this with just jQuery/JS and CSS?
I dont think this will be possible. The keyboard is a system entity that belongs to the browser. You can manipulate the way it is displayed slightly... tailored for email, URL, numeric or phone number.
Have a read here: http://developer.apple.com/library/safari/#codinghowtos/Mobile/UserExperience/index.html
I believe this is only possible as a native app UNLESS you figure out a way (probably with JavaScript) to have your auto-complete suggestions "float" a certain height from the top of the viewing window.
For example, if you measure the screen in pixels, float your auto-complete "bar" x-number of pixels from the top of the iPhone's status bar. Tricky, but possible
精彩评论