好的,所以我有一个脚本可以通过 JSON 从 Google 的 Picasa 图像服务中获取图像。但我希望每页显示 40 张图片。因此,如果用户有超过 40 个,例如 80 个,则将附加一个分页,并显示单击下一个 40 个图像的图像。如果有办法用 jQuery 做到这一点,有人能告诉我怎么做吗?这是通过 JSON 从 Picasa 抓取图像的当前代码
$(document).ready(function() {
$.getJSON("http://picasaweb.google.com/data/feed/base/user/--USERNAME--/?kind=photo&access=public&alt=json&callback=?",
function(data) {
var target = "#picasaweb-images"; // Where is it going?
for (i = 0; i <= 1000; i = i + 1) { // Loop through the 1000 most recent, [0-9]
var pic = data.feed.entry[i].media$group;
var liNumber = i + 1; // Add class to each LI (1-10)
var thumbSize = 2; // Size of thumbnail - 0=small 1=medium 2=large
$(target).append("<ul class='gallery'><li class='no-" + liNumber + "'><a title='" + pic.media$description.$t + "' rel='qpLightbox' href='getPhoto.jsp?o=" + pic.media$content[0].url + "' onClick=return false;><span></span><img src='getThumb.jsp?wl=4&w=170&h=120&url=" + pic.media$thumbnail[thumbSize].url + "' class='oi'/></a></li></ul>");
}
});
});