Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Arvin iuunhao
Added: Jun 18, 2018 8:16 AM
Views: 10
Tags: js
获取滚动条位置
  1. const getScrollPos = (el = window) =>
  2.   ({x: (el.pageXOffset !== undefined) ? el.pageXOffset : el.scrollLeft,
  3.     y: (el.pageYOffset !== undefined) ? el.pageYOffset : el.scrollTop});