是否可以使用无限滚动在内部加载更多页面?

时间:2013-05-16 17:24:10

标签: php javascript html scroll

我的问题如下,我有一个动态页面,从我的产品的数据库中提取图像。我在这里显示了14个带有子产品图像的产品:“http://www.14u-fashion.com/shop/cat/65”。我想删除箭头并使其成为无限滚动,我使用这个库:“github.com/paulirish/infinite-scroll”,一切正常(在这里工作“dokimastiko.14u-fashion.com/shop/cat/65 “)但是当我在滚动时加载更多内容时,使图像转动的javascript(并且每个产品上的箭头'可点击')不会继续。到目前为止,我的代码是

$o . ="$('#catview').infinitescroll({
                   navSelector:'div.nextPage',             
                   nextSelector:'div.nextPage a:first',
                   itemSelector:'#catview div.loadPage',
                   loading: 
                   {
                    finishedMsg: '',
                    msgText: '',
                    img : '/../../../images/loading.gif',
                    },
                    debug:true;
                   animate: true,

   });
   "; 

任何方式使其与JavaScript一起使用?我尝试使用pathParse但发生了更多错误

1 个答案:

答案 0 :(得分:0)

制作你的js代码,使图像变成一个函数,并使用可选的回调$(elem).infinitescroll(options,[callback])再次调用该函数

这样的事情:

function codeForImageTurn(){
    //turn image, click stuff
}

//run once when page load
codeForImageTurn();


//add as callback everytime scroll elements are added so it will re-run
$o. = "$('#catview').infinitescroll({
    navSelector:'div.nextPage',             
    nextSelector:'div.nextPage a:first',
    itemSelector:'#catview div.loadPage',
    loading: 
    {
        finishedMsg: '',
        msgText: '',
        img : '/../../../images/loading.gif', //starting with `/` means root, you can't go anything up
    },
    debug:true;
    animate: true,

},function(){
    codeForImageTurn();
});
";