![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Pull down to refresh on the mobile web browser in HTML.
When there is a requirement to pull down the screen to refresh the page to get latest updates, this can be done with the help of JavaScript, xhttprequests and then touch events.
Pull refresh is a trigger to XHR in AJAX .It adds new data to the element we want.
Pull refresh can be implemented with the help of hijacked JavaScript scrolling mechanism like iscroll. Twitter is using iscroll to pull refresh option.
Another way is to create a refresh handler for overflow:scroll components.
The interface provided can give an idea about the handler interface −
var PullToRefresh= function(callback, wrapper, instructionsText) { //It creates dom elements and append them before content wrapper // <div class="mainWrapper" style="overflow: scroll; height: 600px;"> <div class="pullToReloadWrapper"></div><div class = "contentWrapper"></div> </div> is the markup. // if main wrapper's height is > than content wrapper's height, then change the main wrapper height to be the height of the content wrapper. // scroll main wrapper. // invoke initializeEvents() to inititalize the events };
Advertisements