Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is a bug when i use div #45

Open
metadata1984 opened this issue Apr 21, 2014 · 2 comments
Open

It is a bug when i use div #45

metadata1984 opened this issue Apr 21, 2014 · 2 comments

Comments

@metadata1984
Copy link

consider the flowing example with endless-scroll version 1.8.0
<div id="mylist" class="row">
<div style="height:150px;float:left;">
<div>0</div>
</div>
</div>
<script >
$("#mylist").endlessScroll({
fireOnce: false,
fireDelay: 10,
insertAfter:'div.endless_scroll_content:last',
content: function(i,p,d){
console.log(i,p,d);
return '<div>'+p+'</div>'
}
});
</script>

Then i run my example.i found the srouce html code is :
<div class="endless_scroll_content" data-page="1">
<div style="height:150px;float:left;">
<div>1</div>
</div>
<div class="endless_scroll_content" data-page="2">
<div style="height:150px;float:left;">
<div>2</div>
</div>
</div>
</div>

i found the jquery.endless-scroll.js in line 160.
if (defaults.insertAfter === null) {
return this.options.insertAfter = "" + container + " div:last";
}

the defaults.insertAfter is aways null.
so the content aways insert after "div.endless_scroll_inner_wrap div:last"

It is a bug? Tnx.

@kanesee
Copy link

kanesee commented Sep 1, 2014

I found the same issue. If the list contains a div, this plugin does not work.

The simple fix/hack is to comment out line 112
// this.setInsertPositionsWhenNecessary();

@Harshit369
Copy link

@kanesee thanx!
that worked, but now its necessary to pass both insertBefore and insertAfter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants