2020年3月18日
摘要: const el = document.createElement('textarea'); el.value = str; el.setAttribute('readonly', ''); el.style.position = 'absolute'; el.style.left = '-9999 阅读全文
posted @ 2020-03-18 03:55 wakaka_wka 阅读(1891) 评论(0) 推荐(0) 编辑
摘要: const counter = (selector, start, end, step = 1, duration = 2000) => { let current = start, _step = (end - start) * step < 0 ? -step : step, timer = s 阅读全文
posted @ 2020-03-18 03:54 wakaka_wka 阅读(310) 评论(0) 推荐(0) 编辑
摘要: const getDaysDiffBetweenDates = (dateInitial, dateFinal) => (dateFinal - dateInitial) / (1000 * 3600 * 24); // 事例 getDaysDiffBetweenDates(new Date('20 阅读全文
posted @ 2020-03-18 03:52 wakaka_wka 阅读(271) 评论(0) 推荐(0) 编辑
摘要: const get = (from, ...selectors) => [...selectors].map(s => s .replace(/\[([^\[\]]*)\]/g, '.$1.') .split('.') .filter(t => t !== '') .reduce((prev, cu 阅读全文
posted @ 2020-03-18 03:47 wakaka_wka 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 平滑滚动到页面顶部 const scrollToTop = () => { const c = document.documentElement.scrollTop || document.body.scrollTop; if (c > 0) { window.requestAnimationFra 阅读全文
posted @ 2020-03-18 03:27 wakaka_wka 阅读(196) 评论(0) 推荐(0) 编辑