0

我的问题如下,我有一个动态页面,可以从数据库中为我的产品获取图像。我在这里展示了 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 但出现更多错误

4

1 回答 1

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();
});
";
于 2013-05-16T17:31:30.947 回答