Responsive sidebar and input

纵然是瞬间 提交于 2019-12-11 14:16:47

问题


I have an issue with a responsive menu containing an input. The original thread is here: Fixed Responsive Top Nav / Off Canvas Nav with Single DOM Element

If I add an extra li, with an input (for a search field), I get a jump if I click the input. This happens only if I have scrolled before opening the sidebar.

ul class="left">
      <li class="divider divider-first"></li>
      <li class="active"><a href="#_" class="toggle-nav">Main Item 1</a></li>
      <li class="divider"></li>
      <li><a href="#_" class="toggle-nav">Main Item 2</a></li>
      <li>
        <form method="get" action="/search.html">
          <input type="text" placeholder="Search" name="Search">
        </form>
      </li>
</ul>

Here's the fiddle with the extra li: http://jsfiddle.net/29qgW/5/ If you open the result window on an iPhone, you can see it happening.

Some kind of margin gets added above both the sidebar and the top bar. I tried to find it with the iOS simulator, but the margin is not really there as a style.

It gets even worse if you try to scroll after having selected the input. How can this be fixed? I've tried to change the metatag to disallow user zooming, but that doesn't work.

Does anyone know how to fix this?

Update: edited to show metatag, and closed input tag.

来源:https://stackoverflow.com/questions/20703286/responsive-sidebar-and-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!