无限滚动加载太快
这里有很多单独的问题,我想弄清楚,所以对最近的很多帖子表示歉意;)
我的网站上有无限滚动(其他问题我们不会提及),但整个事情似乎启动得太快,尤其是在分页存在。
这就是我所拥有的:
<script src="<?php bloginfo('template_directory'); ?>/js/jquery.infinitescroll.min.js"></script>
<script>
$(function(){
var $container = $('.rest-of-content');
$container.infinitescroll({
navSelector : '.wp-paginate', // selector for the paged navigation
nextSelector : '.wp-paginate li a', // selector for the NEXT link (to page 2)
itemSelector : '.single-fg-post', // selector for all items you'll retrieve
bufferPX: 20,
loading: {
msgText: 'Fetching more gold...',
finishedMsg: 'Damn! No more gold!',
img: '<?php bloginfo('template_directory'); ?>/images/ajax-loader-black.gif'
}
});
});
</script>
但是,如果您看看它的工作方式: http://goo.gl/L9p00 - 如果你向下滚动一点,你可以看到滚动条滑块变短,因为它在我到达之前就加载了内容。
Lots of separate issues here that I want to figure out so apologies for lots of recent posts ;)
I have infinite scroll working on my site (other issues we won't mention) yet the whole thing seems to fire too quickly, especially before the pagination exists.
This is what I have:
<script src="<?php bloginfo('template_directory'); ?>/js/jquery.infinitescroll.min.js"></script>
<script>
$(function(){
var $container = $('.rest-of-content');
$container.infinitescroll({
navSelector : '.wp-paginate', // selector for the paged navigation
nextSelector : '.wp-paginate li a', // selector for the NEXT link (to page 2)
itemSelector : '.single-fg-post', // selector for all items you'll retrieve
bufferPX: 20,
loading: {
msgText: 'Fetching more gold...',
finishedMsg: 'Damn! No more gold!',
img: '<?php bloginfo('template_directory'); ?>/images/ajax-loader-black.gif'
}
});
});
</script>
Yet, if you look at the way it works: http://goo.gl/L9p00 - if you scroll down a little, you can see the scrollbar slider shorten as it loads the content before I have even reached it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这并没有什么问题。它完全按照预期工作。您希望页面在到达底部之前呈现,因为您不希望用户必须等待。您的服务器可以承受打击。您的用户无法忍受等待。
查看 Pinterest 即可看到完全相同的操作。
There is nothing wrong with this. It's working exactly as intended. You want the page to render before hitting the bottom because you don't want the user to have to wait. Your servers can take the hit. Your users can't stand the wait.
Take a look at Pinterest to see the exact same thing in action.