javascript - 特效

匿名 (未验证) 提交于 2019-12-02 21:40:30

特效

偏移量

  • offsetParent用于获取定位的父级元素
  • offsetParent和parentNode的区别
var box = document.getElementById('box'); console.log(box.offsetParent); console.log(box.offsetLeft); console.log(box.offsetTop); console.log(box.offsetWidth); console.log(box.offsetHeight); 

客户区大小

var box = document.getElementById('box'); console.log(box.clientLeft); console.log(box.clientTop); console.log(box.clientWidth); console.log(box.clientHeight); 

滚动偏移

var box = document.getElementById('box'); console.log(box.scrollLeft) console.log(box.scrollTop) console.log(box.scrollWidth) console.log(box.scrollHeight) 

案例

  • 匀速动画函数
  • 变速动画函数
  • 回到顶部
  • 无缝轮播图
  • 模拟滚动条
  • 拖拽案例
  • 放大镜案例

附录

元素的类型

转载请标明出处:javascript - 特效
文章来源: https://blog.csdn.net/weixin_42235173/article/details/90746743
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!