javascript - rem unit compatibility issue, why is the height of oppo's own browser image uncontrolled
大家讲道理
大家讲道理 2017-06-26 10:53:25
0
1
1112

Use rem to make mobile pages. During the testing phase, there was no problem. On IOS, Android and other mobile phones, everything was perfect.
However, when opening the page with the browser that comes with the oppo phone, rem failed, and only the height of the picture failed. , all the pictures have been elongated.
why is that?

This is the JavaScript code that controls rem

(function (doc, win) {
    var docEl = doc.documentElement,
    resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
    recalc = function () {
        var clientWidth = docEl.clientWidth;    
        if (clientWidth > 640){
            docEl.style.fontSize = 100 + '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);
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
刘奇

Because the technical strength of a small manufacturer like Oppo is not good, and the built-in browser kernel version is too low

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!