【问题标题】:slow query infinitescroll respond on tumblr?tumblr 上的慢查询无限滚动响应?
【发布时间】:2014-06-23 16:14:52
【问题描述】:

我正在使用这段代码,我发现它比以前的代码要快:

<script type="text/javascript">
$(window).load(function(){
var $wall = $('.posts');
$wall.imagesLoaded(function(){
$wall.masonry({
itemSelector: '.entry',
isAnimated : false
});
});

$wall.infinitescroll({
navSelector : "div#navigation",
nextSelector : "div#navigation a#nextPage",
itemSelector : ".entry",
bufferPx : 2000,
debug : false,
errorCallback: function() {
$('#infscr-loading').fadeOut('normal');
}},
function( newElements ) {
var $newElems = $( newElements );
$newElems.hide();
$newElems.imagesLoaded(function(){
$wall.masonry( 'appended', $newElems,{isAnimated: false}, function(){$newElems.fadeIn('slow');} );
});
}); $('.posts').show(500);
});
</script> <script>
$.fn.changebackgroundColor = function(msg) {
$("#perma").css("#000");   }; </script>

但它仍然相当慢,加载帖子有延迟,我想知道我可以改变什么。我使用了 3 列,总共大约 1100 像素。

【问题讨论】:

  • 如果您在发布脚本时格式化/缩进脚本,这真的很有帮助。如果你的编辑器没有很好的重新格式化工具,你可以使用jsbeautifier.org

标签: javascript jquery performance tumblr infinite-scroll


【解决方案1】:

来自文档:问题可能与 bufferPx 属性有关。

             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
  • 2012-05-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-29
  • 2014-11-18
  • 1970-01-01
相关资源
最近更新 更多