Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

87
Views
PullToRefresh Issue when scrolling

I am using the Pull to refresh so when pulled at top of page the page reloads. This is for a web page and I want it to to act like mobile app on refresh.

Problem is if I scroll to bottom of page, even when I begin to scroll back up, it reloads. I only want to do it when the page reaches the top of page.

My code is below. I am using this for reference. https://www.boxfactura.com/pulltorefresh.js/

  /* global PullToRefresh */
  PullToRefresh.init({
    mainElement: '#mainapp',
    onRefresh: function() { location.reload(); alert('refresh') }
  });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I have never used this package, and it seems its purpose for mobile applications. However, you could check if the user is at the top of the page before reloading. Assuming this method will run every time the user scrolls up you can do something like this:

/* global PullToRefresh */
  PullToRefresh.init({
      mainElement: '#mainapp',
      onRefresh: function() {
           if (document.body.scrollTop === 0) {
               location.reload();
               alert('refresh');
           }
      }
  });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!