IOS responsiveness

135
January 21, 2022, at 6:30 PM

I have a header and footer script here but when I scroll back up on IOS there is the scroll bouncing and it records last scroll as a down scroll and hides my header ( important to be shown at top = 0).

What to do to give that condition to overrides this script?

jQuery.event.special.touchstart = {
  setup: function(_, ns, handle) {
    this.addEventListener('touchstart', handle, {
      passive: !ns.includes('noPreventDefault')
    });
  }
};
jQuery.event.special.touchmove = {
  setup: function(_, ns, handle) {
    this.addEventListener('touchmove', handle, {
      passive: !ns.includes('noPreventDefault')
    });
  }
};
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
  var currentScrollPos = window.pageYOffset;
  if (prevScrollpos > currentScrollPos) {
    document.querySelector(".header").style.top = "0";
    document.querySelector(".navicon").style.top = "8px";
    document.querySelector(".groupticket").style.top = "6px";
    document.querySelector(".search").style.top = "14px";
    document.querySelector(".foot").style.bottom = "0px";
    document.querySelector(".filter").style.top = "-50px";
  } else {
    document.querySelector(".header").style.top = "-86px";
    document.querySelector(".navicon").style.top = "8px";
    document.querySelector(".groupticket").style.top = "6px";
    document.querySelector(".search").style.top = "14px";
    document.querySelector(".foot").style.bottom = "-201px";
    document.querySelector(".filter").style.top = "0px";
  }
  prevScrollpos = currentScrollPos;
}

I added this but it seems to mess with the script:

var idVar = setTimeout() => { 
  onscroll() 
}, 1000);
Answer 1

This code uses a function that is listening "scroll" on the page and after 2 seconds executes the command. I did the same script for the footer as well:

var isScrolling;
navbar = document.getElementById("header");
window.addEventListener('scroll', () => {
  header.style.top = "-50px" + header.style.height;
  window.clearTimeout(isScrolling);
  isScrolling = setTimeout(function() {
    header.style.top = "0";
  }, 2000);
}, false);
Rent Charter Buses Company
READ ALSO
android app using html and javascript ajax

android app using html and javascript ajax

I create Simple android app using html,css,javascript & webviewUsing Ajax, I process the data from the asp

40
How to randomly extract column from the data of an excel file with specifically setting a condition in Python

How to randomly extract column from the data of an excel file with specifically setting a condition in Python

I'm trying to randomly extract some data from my excel file through colab (Python)

132
Adapt my chat app to work with socket.io rooms

Adapt my chat app to work with socket.io rooms

I have this chat app that I'm working on for a school project, and I need to improve it a little bit since it is pretty basic and simpleHow can I make it so users can choose the room where they want their messages to be sent to? As a start, I created...

122