- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
UPDATE: It looks like this is a specific bug on the Safari iOS ONLY. Website when loaded as a web app (save on home) does not display the same gap/buffer. You should only be able to solve this.
JSBIN - 在 Mobile safari 和其他浏览器上查看它。
实时输出:http://output.jsbin.com/winuta/
JSBin:http://jsbin.com/winuta/edit?html,js,output
原帖
这是 DIV 中固定到底部的文本区域的非常基本的精简版本。
我正在使用 Flat Bootstrap Admin V3 模板,由于许多消息传递部分存在问题,因此必须对其进行长时间调试。
我的页面在所有浏览器上都能正确显示,但 Mobile Safari 除外,它会在我的文本字段获得焦点时在键盘和正文之间创建一个缓冲区/间隙。
我设法解决了大部分错误,但是当涉及到移动设备时,我在 iOS Safari 上遇到了这个问题,当我专注于文本区域时,它在网页下创建额外缓冲区(我在 100VH 使用 body max-height - 我知道有 Buggy,但我已经使用 JS 和 $(window).innerHeight() 解决了这个问题,效果很好),没有不管我怎么做。
我尝试使用 JS 将所有不同的 div 高度(包括 body 高度)调整为再减去 60px,但仍然存在差距。所有其他浏览器它会粘在键盘的正上方,但 iOS safari 不会。
任何人都可以阐明一些光吗?
文本区域代码
<div class="footer">
<div class="message-box">
<textarea id="draftmsg" placeholder="type something..." class="form-control"></textarea>
<button id="sendmsg" class="btn btn-default"><i class="fa fa-paper-plane" aria-hidden="true"></i><span>Send</span></button>
</div>
此模板主要基于 flex,但我使用的是页脚
.footer {
position: relative; /*Relative to the text display area which occupies whole viewport minus footer*/
bottom: 0;
}
Above image shows how it should look normally without keyboard and user cannot scroll past the text area since text area sticks to bottom.
but the image shows the gap between keyboard and text area in mobile safari
Above image shows other mobile browsers Chrome and Firefox displays fine without the extra buffer.
更新(从评论中回答问题)
我的元标题已经设置如下
<meta name="viewport" content="initial-scale=1.0, user-scalable=0, width=device-width, height=device-height"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
页脚的完整 CSS
.app-messaging .messaging > .footer {
width: 100%;
padding: 8px;
background-color: #dfe6e8; }
.app-messaging .messaging > .footer .message-box {
background-color: #FFF;
border-radius: 2px;
box-shadow: 0 1px 1px #c8d1d3;
width: 100%;
height: 80px;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-ms-flex-align: start;
align-items: flex-start;
-ms-flex-pack: start;
justify-content: flex-start;
border-top: 1px solid #dfe6e8; }
.app-messaging .messaging > .footer .message-box textarea, .app-messaging .messaging > .footer .message-box button {
margin-bottom: 0;
border: 0;
height: 100%;
border-radius: 0; }
.app-messaging .messaging > .footer .message-box textarea {
-ms-flex: 1;
flex: 1; }
.app-messaging .messaging > .footer .message-box button {
border-left: 1px solid #dfe6e8;
color: #29c75f; }
.app-messaging .messaging > .footer .message-box button .fa {
margin-right: 1rem; }
#draftmsg {
line-height: normal;
padding-bottom: 0;
margin-bottom: 0;
}
最佳答案
我的移动网络调试非常不稳定,我主要是后端开发人员所以如果我错了请原谅...
我相信这可能是因为 bottom: 0
。将其更改为 top:
属性以进行检查。这可能没有太大帮助,因为您确实需要将它放在底部,但如果这是问题所在,请考虑切换到 flexbox 以尽可能定位它。
如果不是,修复可能涉及在视口(viewport)元标记中设置“height=device-height”。但如果我没记错的话,只有当相关元素位于/靠近底部时才有效。
希望这有助于...
关于javascript - 主体标签下方的额外间隙/缓冲区(没有人能解决这个问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40707326/
我正在使用matplotlib创建简单的线图。我的图是一个简单的时间序列数据集,其中我沿x轴有时间,而我在y轴上有测量的值。 y值可以具有正值或负值,如果y值> 0,则我想用蓝色填充行上方和下方的颜色
我有一个简单的菜单,当单击菜单项时,该菜单会滚动到某个部分。 例如: Contact 将滚动到: 但是我也有一个始终粘在顶部的菜单,并且该菜单的高度不是用滚动脚本计算的。因此菜单总是悬停在元素的顶部
我有一个 UISearchBar 和 UISearchDisplayController,一切都很好,但我的范围选择器显示在文本字段旁边而不是下方。我知道这是设备横向时的预期操作,但由于我在 UISp
因此,我正在创建一个根据用户输入增大和缩小的 ListView ,我需要四个按钮,但我不知道如何让按钮与 ListView 的底部对齐并位于2x2 网格时尚。我已经尝试过相对布局,但似乎不起作用。谢谢
我正在使用的系统无法直接编辑每个页面上的 HTML。我想添加特定页面正文的顶部,但我输入 HTML 的框会自动将脚本放置在上面 我尝试过这个: $('body').prepend(''); 任何帮
设计模式一切都很好,但在实时导航栏位于 ScrollView 下方我该如何解决这个问题?请帮忙 最佳答案 同样,在没有看到任何代码的情况下很难说,但我相信导航栏根本没有显示。如果您直接从另一个 Vie
我现在必须重用和修改其他人的代码来创建图像处理应用程序。以下代码用于设置框架及其 GUI。我遇到的问题是,当在菜单栏上单击文件字时,菜单项列在 originalImage 容器中包含的 Canvas
我创建了一个 Angular 指令,用户可以在其中根据一天中的时间更改某些设置。下面是我已有的图片: 我想在 div 的 x 轴上添加一种准确表示时间的“滴答”,以向用户显示他在做什么,如下图所示:
这是下面的代码。 body { font-family: "Lato", sans-serif; } .sidenav { width: 130px; positio
这个问题在这里已经有了答案: Z-Index not working? [closed] (1 个回答) 关闭 5 年前。
我搜索了这个并尝试了 Z 轴的东西,但无济于事。基本上,我的导航栏在其下方的 div 下方显示有子菜单。那个 div 发生了不透明的事情,这一定与它有关。我需要这些显示在 div 上方!! JS fi
我正在处理的网站的某些页面使用脚本自动创建基于页面标题的目录。但是,我在获取“toc”div 以将页面的其余内容推送到其下方时遇到了一些问题。 TOC div 在我页面的最里面的 div 中,“con
我的代码 http://jsfiddle.net/p796z/1/ HTML Content Content Content Content Content Content
请看下面的代码: Button dropdown
我有一个表格,我希望它直接位于 Logo 下方位于页面中间。到目前为止,我似乎做不到更有什者。任何帮助将不胜感激。谢谢。 这是 HTML 代码:
我的 web 应用程序在与 jQuery Mobile 和 cordova 的聊天部分出现问题。我决定用 textaera 和发送消息的按钮修复页脚。但是当我触摸文本区域写消息时,我的键盘没有出现。我
我有两个来回箭头,可以单击它们在我的单页网站上的框架中浏览照片。我的术语在这里可能不正确。保存照片和前后箭头的 div 出现在我的屏幕下方,而不是在屏幕场景 div 中。我可以将图像向上移动以出现在屏
我使用自定义 CSS 和 Bootstrap 类名称构建了这个 header 。我已经尝试了 z-index、float: initial 属性。提前致谢 .branding-preview {
我有两个部分介绍网站上的用例和好处。如下。 .onboardmessaging { min-width: 100%; } .onboardmessagingwrap { min-wi
所以,我在网站上发现了这个很酷的 css/html slider ,所以我下载了代码,并打算研究它。我已经开始根据自己的需要对其进行编辑和设计,然后我遇到了这个问题:当我添加比原始尺寸更大的图像时,导
我是一名优秀的程序员,十分优秀!