Rolling loading

tipjs,object,es6

Nguyên tắc là theo dõi các sự kiện cuộn trang và phân tích mối quan hệ thuộc tính giữa clientHeight , scrollTopscrollHeight .

window.addEventListener('scroll', function() {
  const clientHeight = document.documentElement.clientHeight;
  const scrollTop = document.documentElement.scrollTop;
  const scrollHeight = document.documentElement.scrollHeight;
  if (clientHeight + scrollTop >= scrollHeight) {
    // Xử lý ở đây
    // ...
  }
}, false);

Có thể bạn đã miss một số snippets code

using async/await to catch errors

10 mẹo sử dụng array và object trong javascript

10 mẹo sử dụng array và object trong javascript

Sử dụng reduce và concat làm phẳng một array

Array.reduce() và Array.concat() có thể giúp chúng ta làm phẳng một Array như:

using Typescript callback style error handling

Ajax, call jQuery POST to node.js expressjs

Ajax, call jQuery POST to node.js expressjs