主要问题:

1,头部输入框固定后,只要再滑动内容的话,输入框会随着滑动内容而滑动。

2,在低端机:2.3以下的安卓机,你会发现怎么解决都不行的,系统浏览器是不会支持的,头部底部固定的话会滑动内容而滑动。

flex模拟fixed(推荐使用)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>flex模拟fixed</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style>
html,body{
height:100%;
margin:0;
padding:0;
}/**/
.wrap{height:100%;display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-flex:1;display:flex;display:-webkit-flex;flex-direction:column;flex:1;-webkit-flex:1;}
.content{display:-webkit-box;-webkit-box-flex:1;flex:1;-webkit-flex:1;display:flex;display:-webkit-flex;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:5px 5px 60px 5px;} header,footer{position:fixed;z-index:1;left:0;right:0;
height:40px;
text-align:center;
width:100%;
line-height:40px;
background:#fff;
}
header{
border-bottom:1px solid #ccc;
}
footer{
border-top:1px solid #ccc;
bottom:0;
}
h1{margin:0; } </style>
</head>
<body>
<div class="wrap">
<header class="">
<h1 class=""><input type="text"/></h1>
</header> <div class="content">
<div class="">
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2><input type="text"/></h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content-last</h2>
</div> </div>
<footer class="">
<input type="text"/>
</footer>
</div> </body>
</html>

absolute模拟fixed

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>absolute模拟fixed</title> <!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"> <!-- Makes your prototype chrome-less once bookmarked to your phone's home screen -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style>
html,
body{height:100%;margin:0;padding:0;}
header,footer{height:40px; text-align:center; position:absolute; width:100%; line-height:40px; background:#fff; z-index:2;}
header{border-bottom:1px solid #ccc;top:0;}
footer{border-top:1px solid #ccc;bottom:0;}
h1{margin:0; }
.content{position:absolute;top:40px;left:0;right:0;bottom:40px; box-sizing:border-box;overflow-y:auto;-webkit-overflow-scrolling:touch;}
</style>
</head>
<body> <!-- Make sure all your bars are the first things in your <body> -->
<header class="bar bar-nav">
<h1 class="title"><input type="text"/></h1>
</header> <!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) -->
<div class="content">
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2><input type="text"/></h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content</h2>
<h2>content-last</h2>
</div>
<footer class="bar bar-footer">
<input type="text"/>
</footer>
</body>
</html>

目前还会存在的一些问题,页面第一次点击底部输入法是会挡住输入框的,这个情况我测试IOS8系统的时候会出现,小米1S安卓4.0系统没这个问题。

其实可以把底部高度稍微调高点就行;或是点击输入框的时候来一次刷新就不会有这个问题了。

目前我能提供的也只是这个解决方案了,也适合做头部底部fixed固定。

webapp中fixed问题解决方案的更多相关文章

  1. 谈一谈手机WebApp的fixed属性(手机上的固定栏)【转】

    1.iphone/android原生app常见结构 似乎,所有的手机应用,都遵循这样的布局:固定的顶部+固定的底部+可滚动在中间区域.这种“雷同”的模式让人恶心,却不得不承认这是一种很规矩却又很实用的 ...

  2. IE6浏览器不支持固定定位(position:fixed)解决方案(转)

    IE6浏览器不支持固定定位(position:fixed)解决方案   来源:互联网 作者:佚名 时间:12-04 10:54:05 [大 中 小] 点评:有些朋友在进行网页布局时,会遇到IE6浏览器 ...

  3. Svelte Ui Admin后台管理系统|svelte3+svelteUI中后台前端解决方案

    基于svelte3.x+svelteKit+svelte-ui网页后台管理系统SvelteAdmin. Svelte-Ui-Admin 基于svelte3.x+svelteKit+vite3+echa ...

  4. WebApp中的页面生命周期及路由管理

    最近切换到一个新项目,使用的技术栈是Require+Backbone,鉴于对鞋厂webapp框架的了解,发现这个新项目有些缺陷,主要是单纯依赖Backbone造成的,也就是Backbone的好和坏都在 ...

  5. SQL实现递归及存储过程中In()参数传递解决方案[转]

    SQL实现递归及存储过程中In()参数传递解决方案   1.SQL递归 在SQL Server中,我们可以利用表表达式来实现递归算法,一般用于阻止机构的加载及相关性处理.   -->实现: 假设 ...

  6. SQL Server 2008空间数据应用系列十一:提取MapInfo地图数据中的空间数据解决方案

    原文:SQL Server 2008空间数据应用系列十一:提取MapInfo地图数据中的空间数据解决方案 友情提示,您阅读本篇博文的先决条件如下: 1.本文示例基于Microsoft SQL Serv ...

  7. python解释器的安装;python2与python3同时在环境变量中时的解决方案

    新文档 html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,addres ...

  8. tomcat中session在两个webapp中实现共享

    现在遇到一个需求就是要求完成简单的单点登录,通过在一个tomcat实例中放置两个webapps应用ROOT应用和CEO应用来完成在ROOT应用登录后,在CEO可以直接使用,而未在ROOT应用登录时,不 ...

  9. 负载均衡集群中的session解决方案【转】

    通常面临的问题 从用户端来解释,就是当一个用户第一次访问被负载均衡代理到后端服务器A并登录后,服务器A上保留了用户的登录信息:当用户再次发送请求时, 根据负载均衡策略可能被代理到后端不同的服务器,例如 ...

随机推荐

  1. UOJ149 【NOIP2015】子串

    本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转载请注明出处,侵权必究,保留最终解释权! [问题描述]有两个仅包含小写英文字母的字符串 A ...

  2. POJ3525 半平面交

    题意:求某凸多边形内部离边界最远的点到边界的距离 首先介绍半平面.半平面交的概念: 半平面:对于一条有向直线,它的方向的左手侧就是它所划定的半平面范围.如图所示: 半平面交:多个半平面的交集.有点类似 ...

  3. 心血来潮学python

    第一次见python就被吸引了,嗯,前面在linux下调试过一些小段代码.最近工作都在windows下面,也懒得换去unbuntu,所以想着在win下安装python. 之前不知道用什么方法装的pyt ...

  4. sersync2 安装,配置

    介绍 rsync rsync,remote synchronize顾名思意就知道它是一款实现远程同步功能的软件,它在同步文件的同时,可以保持原来文件的权限.时间.软硬链接等附加信息.rsync是用 “ ...

  5. Java 中常用缓存Cache机制的实现

    所谓缓存,就是将程序或系统经常要调用的对象存在内存中,一遍其使用时可以快速调用,不必再去创建新的重复的实例.这样做可以减少系统开销,提高系统效率. 所谓缓存,就是将程序或系统经常要调用的对象存在内存中 ...

  6. HDU1024Max Sum Plus Plus(M段最大和)

    题意:求一个数组中 M 段的 最大和 没看明白怎么搞得 抽空来看,写的不赖 #include <iostream> #include <cstring> #include &l ...

  7. 初识PHP

    初识PHP 虽然是做前端的,可是平时看书.做项目都会与后端PHP相关,但却不是很了解,并经常听PHP大神说:PHP是世界上最好的语言!因此,通过这篇博文学习.总结PHP,来认识认识这个“世界上最好的语 ...

  8. 国家电力项目SSH搭建

    SSH项目框架搭建总结: 1.建立Web工程 * 导入需要的jar的包 db:连接数据库的驱动包 hibernate:使用hibernate的jar包 jstl:java的标准标签库 junit:测试 ...

  9. 用css进行布局

     用css进行布局 一,开始布局的注意事项 1.作为最佳实践,应把html(内容)和css(显示)分离: 2.网站设计主要有两大类型:固定宽度(基于像素)和响应式(也称流式,使用百分数定义) 二,构建 ...

  10. Eclipse Maven Web工程报错:java.lang.ClassNotFoundException: ContextLoaderListener

    原因:打包项目时没有把相关Maven依赖包打到WEB-INF/lib下,正常情况下,会生成lib目录并把工程的所有依赖jar包都部署到该目录下. 解决:右键点击项目--选择Properties,选择D ...