美文网首页
慕课web阅读器开发学习笔记

慕课web阅读器开发学习笔记

作者: fuheideMayuyu | 来源:发表于2018-10-07 21:57 被阅读0次

1.图标下载:阿里图标库
2.图标制作:Icomoon
3.本机ip地址访问需要将localhost改为IP地址0.0.0.0(表示所有IP都可以访问)

 host: '0.0.0.0', // can be overwritten by process.env.HOST
 port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined

4.viewport配置,禁止屏幕放大或缩小。

<meta name="viewport" content="width=device-width,initial-scale=1.0
    maximum-scale=1.0,minimum-scale=1.0,user-scalabel=no">

5.DOMContentLoaded事件动态设置根元素font-size(字体宽度为屏幕宽度的1/10)
html.style.fontSize = window.innerWidth/10 + 'px'

document.addEventListener('DOMContentLoaded',() =>{
  // 选择html根元素
  const html = document.querySelector('html')
  let fontSize = window.innerWidth / 10
  // 当fontSize大于50时等于50,避免字体过大
  fontSize = fontSize > 50 ? 50 : fontSize
  html.style.fontSize = fontSize  + 'px'
})

相关文章

网友评论

      本文标题:慕课web阅读器开发学习笔记

      本文链接:https://www.haomeiwen.com/subject/ypxcaftx.html