摘要:
网页开发时,常常需要了解某个元素是否进入了"视口"(viewport),即用户能不能看到它。 它的用法非常简单(ios有兼容问题)。 var io = new IntersectionObserver(callback, option);上面代码中,IntersectionObserver是浏览器原 阅读全文
摘要:
for..of是ES6中引入的新特性,它主要的作用是:循环一个可迭代的对象。 它可以循环遍历,数组、字符串、Set对象等等 示例一: let str = 'hello' for (item of str) { console.log(item) // h e l l 0 依次打印 } 示例二: le 阅读全文