1 偏移量
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);
2 客戶區大小
var box = document.getElementById('box');
console.log(box.clientLeft);
console.log(box.clientTop);
console.log(box.clientWidth);
console.log(box.clientHeight);
3 滾動偏移
var box = document.getElementById('box');
console.log(box.scrollLeft)
console.log(box.scrollTop)
console.log(box.scrollWidth)
console.log(box.scrollHeight)
4 案例
勻速動畫函數
變速動畫函數
回到頂部
無縫輪播圖
模擬滾動條
拖拽案例
放大鏡案例
5 元素的類型