[英]Is it possible to load more pages with javascript inside using infinity-scroll?
my question is the following ,i have a dynamic page that fetches images from the database for my products. 我的问题是以下内容,我有一个动态页面,可从数据库中获取产品的图像。 I display 14 products with sub-product images over here : " http://www.14u-fashion.com/shop/cat/65 ". 我在此处显示14个带有子产品图像的产品:“ http://www.14u-fashion.com/shop/cat/65 ”。 I want to remove the arrows and made it an infinity scroll , i used this library : "github.com/paulirish/infinite-scroll" , everything works fine (working here "dokimastiko.14u-fashion.com/shop/cat/65") but when i load more content on scroll the javascript that makes the images turn (and the arrows on each product 'clickable') doesn't carry on. 我想删除箭头并使它成为无限滚动,我使用了这个库:“ github.com/paulirish/infinite-scroll”,一切正常(在这里工作“ dokimastiko.14u-fashion.com/shop/cat/65 ”),但是当我在滚动条上加载更多内容时,使图像旋转的javascript(每个产品上的箭头“可点击”)不会继续显示。 My code so far is this 到目前为止我的代码是
$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,
});
";
Any way to make it work with javascript? 任何使其与javascript一起工作的方法? I tried with pathParse but even more errors occur 我尝试使用pathParse,但发生了更多错误
make your js code that makes images turn into a function and use the optional callback $(elem).infinitescroll(options,[callback])
to call the function again 使您的js代码使图像变成函数,并使用可选的回调$(elem).infinitescroll(options,[callback])
再次调用该函数
Something like this: 像这样:
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();
});
";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.