本文解决的问题:
1、怎样在网页中实现拖曳功能;
2、document.documentElement与document.body的区别。
document.documentElement.clientWidth指整个html文档的宽度,document.body.clientWidth的宽度。这两者是不一样的。可以在console控制台通过console.log(document.documentElement)和console.log(document.body)进行测试。
3、getBoundingClientRect().left与offsetLeft的区别。
getBoundingClientRect()用于获取元素的left、top、right、bottom。offset获取相对于父级的left和top。getBoundingClientRect()获取相对于窗口的left、top、right、bottom。
4、e.clientX指的是鼠标点相对于窗口的坐标。
弹窗 #mask { position: fixed; left:0; top:0; width:100%; height: 100%; background-color: hsla(250,100%,50%,0.6); display: none; } #popBox { position: absolute; background-color: #fff; width:200px; height: 200px; }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



