延迟加载博客文章 [英] Lazy load blog posts

查看:75
本文介绍了延迟加载博客文章的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个博客帖子列表,并且数量已达到25个以上,但这全都在一页中,因此我需要尝试构建一个懒惰的加载器.

我尝试了各种插件,但都无法正常工作

http://jsfiddle.net/tara_irvine/S9GGz/6/

http://jsfiddle.net/tara_irvine/S9GGz/9/

http://jsfiddle.net/tara_irvine/S9GGz/13/

有没有一种方法可以检查div的最高值,如果它在视图中,则添加一个类,以便div可见(隐藏div的页面加载)

我查看了这些帖子,但是尝试了各种解决方案后,没有一个对我有用.

如何使用jquery检查元素是否在用户视图中 Div相对于顶部的位置视口

如果有人可以阐明这一点,我将非常感激. 我不知道我要去哪里错了.

非常感谢

解决方案

jQuery Waypoints 是一个不错的选择用于对可见元素做出反应的插件;他们甚至有一个延迟加载示例.

I have a list of blog posts and the number is reaching 25+ but it's all in the one page so I need to try and build a lazy loader.

I have tried various plugins but none are working

http://jsfiddle.net/tara_irvine/S9GGz/6/

http://jsfiddle.net/tara_irvine/S9GGz/9/

http://jsfiddle.net/tara_irvine/S9GGz/13/

Is there a way to check the top value of a div and if it's in view then a class is added so the div becomes visible (page load the div is hidden)

I have looked at these posts but after trying out various solutions none have worked for me.

How to check if an element is in the view of the user with jquery Position of Div in relation to the Top of the Viewport

If anyone can shed some light on this I would be very grateful. I don't know where I am going wrong.

Thanks very much

解决方案

jQuery Waypoints is a nice plugin for reacting on elements coming into view; they even have a lazy-loading example.

这篇关于延迟加载博客文章的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆