A flexible rem layout for h5.
It compiled with iife, so when you import and it will be work.
I recommend inject it at head so that it will be work before html rendered.
And load by cdn is a good idea.
<head> ... <script src="https://easyread.nosdn.127.net/fle/a0df1d4009c7a2ec5fee/1522807676716/lib/index.js"></script> <link rel="stylesheet" href="https://easyread.nosdn.127.net/fle/a0df1d4009c7a2ec5fee/1522807676716/lib/style.css"> ... </head>
By default, 1rem = 50px, you can also set it by yourself before loaded.
- window.MAX_WIDTH = 1024 [fixed width if screen is very large]
- window.DIV_PART = 15 [It means 1rem = (750 / 15)px]
- window.BODY_SIZE = 12 [set body's font-size]
- window.remUnit -> number
- window.px2rem (number|number+px) -> function
- window.rem2px (number|number+rem) -> function
# serve with hot reload at localhost:5000 fle dev # build for production with minification fle build
For detailed explanation, consult the docs for fle-cli.