Closed CaniceZ closed 5 years ago
sorry,I thought you were Chinese。My question is using the 750 configuration when the screen is over 750?
@CaniceZ 750 is your design width? Try config like this:
module.exports = {
plugins: {
...
'postcss-px-to-viewport': {
viewportWidth: 750,
landscape: true,
landscapeUnit: 'px',
landscapeWidth: 750 * 100 / 414
}
}
}
Maybe in future we will add the ability to pass function to viewportWidth
, like function (px) { return ...; }
.
@CaniceZ 750 is your design width? Try config like this:
module.exports = { plugins: { ... 'postcss-px-to-viewport': { viewportWidth: 750, landscape: true, landscapeUnit: 'px', landscapeWidth: 750 * 100 / 414 } } }
Maybe in future we will add the ability to pass function to
viewportWidth
, likefunction (px) { return ...; }
.
Thank you and look forward to your update
@CaniceZ landscape*
options already in project: https://github.com/evrone/postcss-px-to-viewport/blob/master/README_CN.md#配置参数
我之前是自己写是这样写的如下:
(function (doc, win) {
| var docEl = doc.documentElement, | resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', | recalc = function () { | var clientWidth = docEl.clientWidth; | if (!clientWidth) return; | if(clientWidth>415){ | docEl.style.fontSize = 100 (414 / 640) + 'px'; | }else{ | docEl.style.fontSize = 100 (clientWidth / 640) + 'px'; | } | }; | | if (!doc.addEventListener) return; | win.addEventListener(resizeEvt, recalc, false); | doc.addEventListener('DOMContentLoaded', recalc, false); | })(document, window);
有没有哪个配置可以修改视图的阈值类似超过屏幕超过750就按750的来计算