vue开发项目常见业务


1.h5底部输入框被键盘遮挡问题

如果你遇到h5页面这个问题,当输入框在最底部,点击软键盘后输入框会被遮挡,可以如下解决问题:

var getHeight = $(document).height();

$(window).resize(function(){
 if($(document).height() < getHeight) {
  $('#footer').css('position','static');
 }else {
  $('#footer').css('position','absolute');
 }
});

2.触屏即播放

$('html').one('touchstart',function(){
 audio.play()
})

3.阻止旋转屏幕时自动调整字体大小

html, body, form, fieldset, p, div, h1, h2, h3, h4, h5, h6 {-webkit-text-size-adjust:none;}

4.主流网站布局

页面分为3个部分:页面的顶部header,底部footer,中间部分(侧栏side和主要部分main)。

下面代码展示:

<body>
 // 页面层容器
 <div id="container">
  // 页面头部
  <div id="header"></div>
  // 页面主体
  <div id="main">>
   // 侧边栏
   <div id="side">
   </div>
  </div>
  // 页面底部
  <div id="footer"></div>
 </div>
</body>

设计页面样式代码如下:

<style type="text/css">
 body{
  font: 12px 微软雅黑;
  margin: 0px;
  text-align: center;
  background: #fff;
 }
 
 // 页面层容器
 #container {
  width: 100%;
 }
 #header {
  width: 800px;
  margin: 0 auto;
  height: 100px;
  background: #FFCC99;
 }
 #main {
  width: 800px;
  margin: 0 auto;
  height: 400px;
 }
 #side {
  float: left;
  width: 20em;
  background: red;
  padding: 15px 0;
 }
 #foot {
  width: 800px;
  margin: 0 auto;
  height: 50px;
  background: #00ffff;
 }
</style>

效果图如下:


文章作者: luckyu
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 luckyu !
评论
 上一篇
下一篇 
Promise入门 Promise入门
所谓单线程,是指 JS 引擎中负责解释和执行 JavaScript 代码的线程只有一个,也就是一次只能完成一项任务,这个任务执行完后才能执行下一个
2021-06-05
  目录