Giter Site home page Giter Site logo

flexible.js's Introduction

flexible.js

移动端适配问题

可以在各种全家桶项目的入口文件中引入:


首先安装flexible.js


npm i -S flexible.js
或者

如果npm安装比较慢的话,使用淘宝镜像cnpm安装


先在命令行工具里面输入:


npm install -g cnpm –registry=https://registry.npm.taobao.org

成功之后输入:



cnpm i -S flexible.js

找到目录



src/main.js

ES6 Module

import flexible from 'flexible.js'

flexible();

或者 AMD/CMD



require('flexible.js')()

注意因为移动端的设计稿通常是按照iphone6的尺寸,即750 * 1334,所以我在封装的时候内部设默认置的第一个参数即设计稿尺寸为750,第二个参数为最大宽度,默认设置的是640, 即没有兼容到ipad等大屏幕设备,你们在开发中可以结合实际的情况自己传入对应的参数即可!

如果您使用的sublime编辑器,可以下载插件remunit,如果您使用的是vscode编辑器,可以下载插件cssrem,两个都需要配置:50基数,即:


 font-size:1rem;/*50px*/

flexible.js's People

Contributors

wanlixi 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.