0

从无限滚动回调的正确方法是什么?目前这个`

$(function() {
    code(); 
    $('#catview').infinitescroll({ 
        dataType: 'html',
        navSelector: 'div.nextPage',
        nextSelector: 'div.nextPage a:first',
        itemSelector: '#catalogue',
        loading: {
            finishedMsg: '',
            msgText: '',
            img: '/../../../images/loading.gif',
        },
        debug: true,
        animate: true 

    }, $(function() {
        code();
    }));
    });`

不起作用:(如果我在代码()之前设置了一个警报,我会在页面加载时看到它,就是这样......代码的另一部分是:

    function code() {
alert('1')
    $('.teest').caroufredsel({
        direction: 'left',
        circular: true, 
        items: {
            visible: 1, 
            minimum: 2, 
        },
        scroll: {
            fx: 'fade', 
            easing: 'easeOutCubic', 
            duration: 200, 
        },
        auto: {
            duration: 1600
        },
        width: 208,
        height: 265,
        prev: {
            button: '.prev'
        },
        next: {
            button: '.next'
        } 
    });
}

如果运行这两个代码,我所看到的只是警报 1,caroufredsel 在第一页上工作,如果我向下滚动到秒页面没有任何反应,它只是加载

4

2 回答 2

0

原来 $(function... 从 javascript 引擎读取为对象,并且 infinity-scroll 不能回调对象。从函数中删除所有 $ 解决了一切

于 2013-05-21T23:09:50.333 回答
0

请试试这个:-

$(function() {

    $('#catview').infinitescroll({
        dataType: 'html',
        navSelector: 'div.nextPage',
        nextSelector: 'div.nextPage a:first',
        itemSelector: '#catalogue',
        loading: {
            finishedMsg: '',
            msgText: '',
            img: '/../../../images/loading.gif',
        },
        debug: true,
        animate: true 
    },
    function(arrayOfNewElems)
    {
         code();
    });
});

根据Infinite Scroll Jquery 文档回调函数更改您的代码

 $(function() {
    code();
 }));

function(arrayOfNewElems){
 //here your collaback function
});
于 2013-05-21T06:21:49.250 回答