mirror of https://github.com/onweru/compose.git

weru
06.57.2021 3f2ccb9b9acb30834cb7759d14b57f884ea03981
add helper

Signed-off-by: weru <fromweru@gmail.com>
1 files modified
18 ■■■■■ changed files
assets/js/index.js 18 ●●●●● patch | view | raw | blame | history
assets/js/index.js
@@ -363,6 +363,24 @@
    toggleMenu(event);
  });
  (function backToTop(){
    const toTop = elem("#toTop");
    window.addEventListener("scroll", function(e) {
      const lastKnownScrollPosition = window.scrollY;
      if(lastKnownScrollPosition >= 200) {
        toTop.style.display = "flex";
        const viewPort = window.innerWidth;
        const maxBodyWidth = 1240;
        // if(viewPort > maxBodyWidth) {
        //   toTop.style.right = `${((viewPort - maxBodyWidth) / 2)}px`;
        // }
        pushClass(toTop, active);
      } else {
        deleteClass(toTop, active);
      }
    })
  })();
}
window.addEventListener('load', loadActions());