• 2024-09-24万象更新 Html5 - dom: DOM scroll
    源码https://github.com/webabcd/Html5作者webabcd万象更新Html5-dom:DOMscroll示例如下:dom\demo4.html<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>DOMscroll</title>
  • 2024-09-11echarts大屏适配(rem)+图表的文字适配
    echarts大屏适配以及图标配置项里面的文字适配。1-创建js文件,并复制下面的函数(functionflexible(window,document){vardocEl=document.documentElementvardpr=window.devicePixelRatio||1//adjustbodyfontsizefunctionsetBodyFontSize(){
  • 2024-08-13浏览器窗口放大缩小自动适配字体和元素的大小
    通过JavaScript动态设置根元素(html)font-size,rem的建立最初的字体在Vue项目的入口文件(如main.js)中,根据html的`font-size:functionsetHtmlFontSize(){constbaseSize=16;//基础字体大小constdesignWidth=1920;//设计稿的宽度constclientWidth=
  • 2024-07-05Ant Design Vue文字溢出鼠标滑上显示tooltip。不溢出,鼠标滑上不显示tooltip,溢出显示tooltip
    <templateslot="testContent"slot-scope="{record}"><a-tooltip@mouseenter="showToolTip"overlayClassName="customtooltip_class"
  • 2024-04-16clientWidth、offsetWidth、scrollWidth区别
    clientWidthclientWidth包括了元素的内边距(padding)和实际内容的宽度offsetWidthoffsetWidth包括了元素的边框(border)、内边距(padding)、滚动条(如果有)、元素的实际内容的宽度scrollWidthscrollWidth包括了元素的实际内容的宽度,但不包括边框(border)、内边距(padding)和滚动条(如果
  • 2023-09-16offsetWidth或者clientWidth获取不到,值为0的坑
    检查要获取的元素是不是已经显示了才获取offsetWidth,一定要确保获取offsetWidth的时候元素已经显示。来源:offsetWidth或者clientWidth获取不到,值为0的坑_offsetwidth为0_心刻的博客-CSDN博客
  • 2023-09-16区分offsetWidth scrollwidth clientwidth
    链接: 从原理上搞懂offsetWidth、scrollWidth、clientWidth以及其他偏移量_scrollwidthoffsetwidth_J0kerrr的博客-CSDN博客
  • 2023-09-14antui-alipay风格的移动网页设计
    地址:antui.alipay.com需要加入的一些js控制,见https://myjsapi.alipay.com/fe/preset-assets.html参考代码:<!DOCTYPEhtml><!--A11Y:注意设置页面的lang属性--><htmllang="zh"><head><metacharset="utf-8"/><!--A11Y:打开页
  • 2023-08-12rem布局快速写法
    vw的兼容性已经没问题,现在推荐优先使用vw但是rem布局还是有其用武之地,比如需要动态改变字体大小的场景(有小,中,大三种字体,可手动选择,方便不同人群查看)vw和rem的兼容性|兼容性|ios|安卓||rem|4.1+|2.1+||vw|6.1+|4.4+|js快速写法(与设计稿不挂钩)docu
  • 2023-06-09CSS: offsetWidth offsetHeight clientWidth clientHeight scrollWidth scrollHeight
       <!DOCTYPEhtml><htmllang="en-US"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"cont
  • 2023-05-31vue监听浏览器窗口大小变化,做对应的操作
    页面初始化mounted的时候,通过document.body.clientWidth和document.body.clientHeight获取到浏览器的宽和高,然后通过window.onresize来监听浏览器窗口的变化,在这里来改变我们的变量宽和高即可。(created()的时候不行,因为此时document还没有生成)<template><sectionclass="p-1
  • 2023-05-30大屏幕适配小屏幕
    <metaname="viewport"content="width=device-width,initial-scale=1.0,user-scalable=no"><script>vartid,doc=document,docEl=doc.documentElement;varrefreshRem=function(){
  • 2023-04-28不跳动(除了ie6) 总在最右下角
    <mce:scripttype="text/javascript"><!--window.onresize=window.onscroll=window.onload=function(){varwin_w=document.documentElement.clientWidth;//窗口宽varspace_w=0;//左空白宽if(win_w>1000){//窗口大于ma
  • 2023-04-12网页单位为(rem)时,js控制自适应字体大小
    //js部分:屏幕大小决定根元素字体大小(functionflexible(window,document){functionresetFontSize(){constsize=(document.documentElement.clientWidth/1920)*16;//1920为设计稿宽度if(document.documentElement.clientWidth>1920){doc
  • 2023-03-15clientHeight、clientWidth innerHeight innerWidth
    https://www.runoob.com/jsref/prop-win-innerheight-innerwidth.htmlinnerHeight返回窗口的文档显示区的高度,如果有垂直滚动条,也包括滚动条高度。innerWidth返回窗口
  • 2023-03-11h5移动端适配
    1.viewviewport缩放适配(()=>{letviewprot=document.querySelector('#viewport');//获取设备宽度letcurWidth=document.documentElement.clientWidth;
  • 2023-02-19jeasyui 弹出遮罩层
    此遮罩用的是jeasyui源码里的: <html><head><scriptsrc="jquery-1.8.0.min.js"type="text/javascript"></script><scriptsrc="jquery.json-2.4.js"
  • 2023-02-09Webpack实现将CSS中的px转换为rem
    由于现在众多移动设备的兴起,各种手机厂商推出了许多不同屏幕尺寸大小的手机型号,前端人员在编写代码时就需要适配各种手机屏幕。传统的样式适配是利用CSS的媒体查询,但是这种
  • 2023-02-08在线直播源码,js获取滚动条的位置
    在线直播源码,js获取滚动条的位置一.获取当前页面滚动条纵坐标的位置 document.body.scrollTop与document.documentElement.scrollTop IE6/7/8/IE9及以上:可以使用d
  • 2023-01-19index.html
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="utf-8"/><metaname="viewport"content="width=device-width,initial-scale=1"/><metana
  • 2023-01-11前端实时更改根目录font-size
    <script>(function(){//在标准375px适配下,100px=1rem;varbasefontsize=100;varbasewidth=375; varset=function(){varclientwidth=do
  • 2022-12-21[echart] 字体自适应的方法(使用rem)
    functionsetFontSize(res){constclientWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;if(!clientWidth)return;
  • 2022-12-15使用this.$refs.xxx.clientWidth获取不到对象,报错Cannot read properties of undefined (reading 'clientWidth&
    根据搜索结果显示,有几种可能1、组件使用了懒加载。  排除这种可能2、组件上使用了v-for.v-if等。经判断,是这个问题 
  • 2022-12-12clientWidth & scrollWidth:
    clientWidth:只读属性 Element.clientWidth 对于内联元素以及没有CSS样式的元素为0;否则,它是元素内部的宽度(以像素为单位)。该属性包括内边距(padding),但不包括边框(bord
  • 2022-12-05html页面高度不同浏览器兼容性设置
    页面需要嵌套在跨域的iframe中,而页面高度不固定,需要每个页面把自己的高度获得后,通过js通知iframe调整显示。而页面在获得自己的高度时,发现总是比预想的大。经过参考别人的博