本文给大家介绍ajax如何实现点击加载更多数据图片(预加载)效果的,有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>ajax点击加载更多数据--博客园--勇淘未来</title> <script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.11.1.min.js">本地测试dataNews.json文件:
[ { "img":"img/sina.jpg","title":"百度音乐1" } , { "img":"img/tengxu.jpg","title":"百度音乐2" } , { "img":"img/sina.jpg","title":"百度音乐3" } , { "img":"img/tengxu.jpg","title":"百度音乐4" } , { "img":"img/tengxu.jpg","title":"百度音乐5" } , { "img":"img/sina.jpg","title":"百度音乐6" } , { "img":"img/tengxu.jpg","title":"百度音乐7" } , { "img":"img/sina.jpg","title":"百度音乐8" } , { "img":"img/tengxu.jpg","title":"百度音乐9" } , { "img":"img/sina.jpg","title":"百度音乐10" } , { "img":"img/tengxu.jpg","title":"百度音乐11" } , { "img":"img/sina.jpg","title":"百度音乐12" } , { "img":"img/tengxu.jpg","title":"百度音乐13" } , { "img":"img/sina.jpg","title":"百度音乐14" } , { "img":"img/tengxu.jpg","title":"百度音乐15" } ]点击更多图片,加载2条数据,当数据加载完了,就显示 “没有更多了”