简体   繁体   English

Tumblr无限滚动脚本不起作用

[英]Tumblr Infinite Scroll Script Not Working

I've been trying to use Paul Irish's Infinite Scrolling Script for tumblr for a while now but I can't get it to work. 我一直在尝试使用Paul Irish的无限滚动脚本来暂停tumblr一段时间,但我无法让它工作。 (It just doesn't load the next set of posts) (它只是不加载下一组帖子)

This is the part of the code: 这是代码的一部分:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

 {block:IndexPage}
{block:ifInfiniteScroll}
<script src="//static.tumblr.com/wgijwsy/u2vm2hxv6/jquery.infinitescroll.min.js"></script>
{/block:ifInfiniteScroll}
{/block:IndexPage}

<script>

$(document).ready(function(){
var $container = $('.content');

    {block:IndexPage}
    {block:ifInfiniteScroll}  

    $container.infinitescroll({
        itemSelector: '.posts',
        navSelector: '.pagination',
        nextSelector: '.next',
        loadingImg: '',
        loadingText: '<em></em>',
        bufferPx: 2000
        });

    {/block:ifInfiniteScroll}
    {/block:IndexPage}

});


</script>

The selectors should be right. 选择者应该是正确的。 And this is the whole code: http://pastebin.com/cAN5PwSR 这是整个代码: http//pastebin.com/cAN5PwSR

This is my test blog: http://codeheaven-wip.tumblr.com/ (Yes, The "Infinite Scrolling" Option is on at the moment.) 这是我的测试博客: http//codeheaven-wip.tumblr.com/ (是的,目前“Infinite Scrolling”选项已开启。)

I would really appreciate you taking your time to try to help me. 我非常感谢你花时间试着帮助我。 This not working has been driving me insane. 这不起作用一直让我疯狂。 Thank you very much in advance! 非常感谢你提前!

Try passing ($) into your function like this: 尝试将($)传递给您的函数,如下所示:

$(document).ready(function($){

    var $container = $('.content');

    ...

});

It seemed to take away the console error I was seeing - however I was not able to test fully. 它似乎带走了我所看到的控制台错误 - 但是我无法完全测试。 Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM