Giter VIP home page Giter VIP logo

mobile-awesome's Introduction

  • window.devicePixelRatio = 物理像素 / dips (设备独立像素)  

  • img 一定要设置 width 和 vertical

img {
  vertical-align: middle;
  width: 100%;
}
  • 当包含 input 的父容器设置 transform: translate(-50%, -50%) 时, input 有可能无法弹出输入法;
div.parent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

当前解决办法: 改用 flex 布局来设置垂直水平居中

  • 在调用微信的 JS-SDK 时, 一定要设置 link 属性, 否则 JS-SDK 会不生效

  • a input button 标签在移动端需要设置触摸高亮隐藏

a, input, button {
  -webkit-tap-highlight-color:rgba(0,0,0,0);
}
  • 在 ios 设备, screen.width * window.devicePixelRatio 得到的是物理像素值

  • 在 android 以及 windows phone 设备, screen.width 除以 window.devicePixelRatio 得到的是设备独立像素值 (dips)

  • 需要同时获得整数和小数点为 .5 结尾的技巧

let score = Math.floor(score * 2) / 2

mobile-awesome's People

Contributors

zengtao95 avatar

Stargazers

buctgrace avatar

Watchers

James Cloos avatar Tao Zeng avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.