I was working on the mobile phone recently, and found that there are very few jq controls for pull-down refresh and pull-up loading, and I feel that they are not easy to use, such as iscroll...
Then I wrote a lazy loading one myself, too Very simple, the most basic code [don’t spray it if you don’t like it, but it’s quite practical]
wap mobile terminal lazy loading paging:
Quote jquery.js before using it
var current = 1; $(function() { $('body').bind('touchmove', function(e) { if($(this).scrollTop() > ($(window).height() * current - 150)) {//这里的150表示距离底部150像素触发,可自行调节 current++; console.log("第" + current + "页"); //这里放你的分页代码 } }); });
if($(this).scrollTop()==0){//This is the wap refresh code, please use it together if necessary}
web Lazy loading paging on the computer side:
Quote jquery.js before using it
var current = 1; $(function() { window.onscroll = function() { if($(document).scrollTop() >= ($(document).height() - $(window).height() - 150)) {//150与wap手机端一样 current++; //这里放你的分页代码 } } });
if($(document).scrollTop()= =0){//This is the web refresh code, please use it together if necessary}
Web computer side footer bottom fixed:
.footer.position { position: absolute; bottom: 0; }
$(function() { auto(); window.onresize = function() { auto(); } }); function auto() { if($(window).height() > 917) {//917可自行调整,根据页面的内容高度 $(".footer").addClass("position"); } else {//.position见css $(".footer").removeClass("position"); } }
Another method [Recommended]
function auto() { $("body").scrollTop(1); //控制滚动条下移1px if($("body").scrollTop() > 0) { $(".footer").removeClass("position"); alert("有滚动条"); } else { $(".footer").addClass("position"); alert("没有滚动条"); } $("body").scrollTop(0); //滚动条返回顶部 }
Attached are two before and after comparison pictures, the footer fixes the bottom
The above is the entire content of this article. I hope that the content of this article can bring some help to everyone's study or work. I also hope to support the PHP Chinese website. !
For more articles related to paging && website footer adaptation implemented by lazy loading, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment
