首页 > 其他分享 >浏览器中的位置坐标、批量设置 style

浏览器中的位置坐标、批量设置 style

时间:2023-01-06 09:22:36浏览次数:39  
标签:style 浏览器 background 批量 坐标 设置

浏览器中的位置坐标

  • clientX

    距离浏览器视口区的水平坐标(只有鼠标事件才有该属性)

  • getBoundingClientRect()

    获得该元素的宽、高、以及相对于浏览器视口区的水平坐标

批量设置 style

这样貌似会覆盖 style 的其它属性

progressBarFull.setAttribute('style', `
    border-radius: 4px;
    height: 4px;
    marginLeft: 99px;
    marginTop: 22.8px;
    background: white;
    position: absolute;
    left: 49px;
    top: 1.3px;
`)

单独设置

progressBarEmpty.style.background = "-webkit-image-set(url('./TemplateData/loading.png') 2x) no-repeat"

标签:style,浏览器,background,批量,坐标,设置
From: https://www.cnblogs.com/zhumenglong/p/17029425.html

相关文章