【问题标题】:Infinite scroll slow to load new content无限滚动缓慢加载新内容
【发布时间】:2013-07-15 14:25:32
【问题描述】:

我正在使用 infinite scroll 通过 ajax 将新内容/图像加载到 wordpress 主题的索引中。

该网站在 http://mylife.holstee.com/

直播

这是我正在使用的代码,它位于 require.js 的深处,并且已被缩小,因此您将无法自己找到它。

$container.infinitescroll({
        nextSelector: "#mylife-quinary .next-link a",
        navSelector: "#mylife-quinary .next-link",
        itemSelector: "#mylife-quaternary .item"
    }, function( newElements ) {
        mylife.quote();
        var $newElems = $( newElements ).css({ opacity: 0 });;
        $newElems.imagesLoaded(function(){
            $newElems.animate({ opacity: 1 });
            $container.masonry( 'appended', $newElems );
        });
    }
);

$container.imagesLoaded( function(){
    $container.masonry({
        itemSelector : '.item',
        columnWidth : $(".item").outerWidth(true)
    });
});

我想要的是一个更流畅的界面,这样你就不必等待新的内容了。 有什么想法吗?

【问题讨论】:

  • 图片加载时间过长,或者内容加载时间过长。使用浏览器的控制台找出它是什么。

标签: javascript jquery infinite-scroll


【解决方案1】:

来自www.infinite-scroll.com

element.infinitescroll({
// ...
  bufferPx : 40,
    // increase this number if you want infscroll to fire quicker
    // (a high number means a user will not see the loading message)
    // new in 1.2
    // default: 40
// ...
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-13
    • 2014-07-31
    • 1970-01-01
    • 2014-03-01
    • 1970-01-01
    • 2020-01-22
    • 1970-01-01
    相关资源
    最近更新 更多