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 , scrollTop và scrollHeight .

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

How to use the spread operator to flatten array of objects in javascript

How to use the spread operator to flatten array of objects in javascript

How to reverse an Array?

Reversing an array in JS is really simple with the standard array method. Like below

Random String

Random String với độ dài tuỳ chọn

Detect when your site is visible to users

Detect when your site is visible to users