0

Im trying to make a footer fully showing in the bottom once I scroll.

https://teste.contahl.com/

It is working on desktop, but not in mobile, can someone help me with?

Tkx

CSS---

footer{
    position:fixed;
    bottom:0;
    height: 10vh;
    width: 100vw;
    transition: bottom 0.2s ease-in-out;
}

JS---

var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
  if (prevScrollpos > currentScrollPos) {
    document.getElementById("footer").style.bottom = "0";
  } else {
    document.getElementById("footer").style.bottom = "-5vh";
  }
  prevScrollpos = currentScrollPos;
}
3
  • This works fine in the mobile-simulation mode with FF. This works with chrome (both desktop, desktop in mobile simulation mode and on the android device) with some glitches (but still works). What device are testing this on?
    – Jared
    Commented Feb 25, 2023 at 14:18
  • Hi, I was testing on a iPhone 13 mini. For some reason it seems ok here. Thank you
    – Orange_LX
    Commented Feb 25, 2023 at 19:33
  • You might find IntersectionObserver useful.
    – A Haworth
    Commented Feb 25, 2023 at 20:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.