This commit is contained in:
2023-02-28 14:02:39 +08:00
commit 9b86baa44f
170 changed files with 29943 additions and 0 deletions

34
src/assets/js/rem.js Normal file
View File

@@ -0,0 +1,34 @@
// (function (doc, win) {
// var docEl = doc.documentElement
// var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
// var recalc = function () {
// var clientWidth = docEl.clientWidth
// if (!clientWidth) return
// docEl.style.fontSize = 100 * (clientWidth / 1920) + 'px'
// document.body.style.display = 'block'
// }
// if (!doc.addEventListener) return win.addEventListener(resizeEvt, recalc, false)
// doc.addEventListener('DOMContentLoaded', recalc, false)
// })(document, window)
(function () {
var _self = this
_self.width = 1920
_self.fontSize = 100
_self.widthProportion = function () {
var p = ((document.body && document.body.clientWidth) || document.getElementsByTagName('html')[0].offsetWidth) / _self.width
return p
}
_self.changePage = function () {
document.getElementsByTagName('html')[0].setAttribute('style', 'font-size:' + _self.widthProportion() * _self.fontSize + 'px')
}
_self.changePage()
window.addEventListener('resize', function () {
let clientWidth = ((document.body && document.body.clientWidth) || document.getElementsByTagName('html')[0].offsetWidth)
if (clientWidth >= 1550) {
_self.changePage()
} else {
document.getElementsByTagName('html')[0].setAttribute('style', 'font-size:' + 1550 / _self.width * _self.fontSize + 'px')
}
}, false)
})()