-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Multi instance in one page #93
Comments
Hello I've got same problem. On my website I have more than one containers with their own pagination. Best regards |
Seems like a bug to me. This should be possible. |
Any update regarding this issue? I also noticed that Trigger button of Container A disappears when the page loads items of Container B (on the same page). |
Any update or workaround out there for this problem? |
I think the latest version (v2) should have fixed this. Can someone confirm this? |
The problem is not fixed. If you have different called containers and items. |
Can you send me an url where the problem occurs? |
Hi, If you have to pages with infinite ajax scroll, one for listing games and one for news then the problem exists. The problem appears if you initialize the infinte ajax scroll in your main javascript file which will be loaded on every page, then the first initilization will be overwritten. var gamesIAS = jQuery.ias({
container: '.games',
item: '.game',
pagination: '#pagination',
next: '.next',
delay: 200
});
gamesIAS.on('rendered', function() {
loadPlugins();
});
gamesIAS.extension(new IASSpinnerExtension());
gamesIAS.extension(new IASNoneLeftExtension({
text: 'Keine weiteren Games vorhanden',
}));
gamesIAS.extension(new IASTriggerExtension({
text: 'Weitere Games laden...',
}));
var ias = jQuery.ias({
container: '.news',
item: '.news-article',
pagination: '#pagination',
next: '.next',
delay: 200
});
ias.extension(new IASSpinnerExtension());
ias.extension(new IASNoneLeftExtension({
text: 'Keine weiteren News vorhanden'
}));
ias.extension(new IASTriggerExtension({
text: 'Weitere News laden...'
})); My workaround is to wrap each initialization with a "check if list exist"-statement like: if ($(".gamelist-news").length > 0) { |
Great, that clarifies a lot, I will look into it some time soon. |
Hello @fleg. Any progress on this or idea of when you might be able to resolve? I have about a month before i have to complete a project and would really like to use infinite-ajax-scroll through kop's yii2 extension. |
Hi @drawlusyk, sorry no progress yet on this issue. Also can't give you an estimate :( |
This issue also extends into websites that uses AJAX loading like jQuery-Pjax. Because the DOM is not reset, the IAS bindings and variables are persisted across pages. So far I've been able to mitigate most issues by unbinding and resetting the IAS data with this $(document).one('pjax:popstate pjax:beforeReplace', function (e) {
// navigating away from page
$.ias().unbind(); // unbind window scroll event handler
$(window).removeData('ias'); // remove current ias data stored in window
}); Unfortunately this only unbinds the window scroll handler (which is the most problematic) but it does nothing for the extensions that have been registered or the extension settings. This is where settings will overwrite each other (if you have multiple IAS on the page, or multiple IAS are used as the DOM is replaced). In theory the |
Yes, I also became aware of that while I was working on this for a potential fix. So please know that I'm still working on it. |
Still no news on fixing this issue? |
@longzheng this should now be fixed in v2.2.0. Can you verify this? |
I think its not fixed.I have tried in http://www.yiiframework.com/extension/yiinfinite-scroll/ with new version of JS |
Yiinfinite-scroll seems totally not related to Infinite AJAX Scroll. |
I am also experiencing this issue with v2.2.0. |
Finally reading all the comments I am also one who face the same issue for multiple tab with use of ifiniteajaxscroll in each tab ...any good news |
Any hope on this or Info how to do that? |
You can use the Link pager widget with listview and add below jquery which will just replace ur next button to ur HTML; $("#pagination3 > .prev ").css("display","none");
$("#pagination3 > .next3 > a").click(function(e){
e.preventDefault();
$.ajax({
url: $(this).attr("href"),
type: "get",
success: function(data) {
var items =$(data).find("#list-wrapper3 > .item3") ;
$("#list-wrapper3 ").append(items);
if($(data).find("#pagination3 > li.next3").hasClass("disabled")){
$("#pagination3 > .next3 > a").remove();
$("#pagination3 > .next3 ").text("No more items to display");
}
else {
var next3 = $(data).find("#pagination > li.next3 > a").attr("href") ;
$("#pagination3 > .next3 > a").attr("href",next3);
}
}
});
}) and Linkpager will be below code LinkPager::widget([
'pagination' => $pages3,
'nextPageLabel' => 'Load more',
'nextPageCssClass'=>'load-more text-center next3',
'options'=>['tag'=>'div','class'=>'load-more','id'=>'pagination3' ],
'maxButtonCount'=> 0,
]); |
Thanks for your Idea. |
dear hitesh2088, |
Dear, I hope you understand I have implemented this in one of the client project dont have any jsfiddle |
Hey, is it possible you are talking about a complete different Extension? |
Link pager is widget of Yii2 by which pagination can be created |
@fieg do you have any time for this? Maybe you need some help with test data or something else (I wanted to create a PR, but I can't find an issue)? This issue is really frustrating... |
With my PR merged in master multiple instances should be reliably possible now. One thing to note is that you should not nest scroll containers when you do. The outer scroll container might start working with elements from the inner scroll container. |
Thank you great plugin. There are multiple page-navigation on "one" page in my site. It works almost well. However, I have one problem. Trigger tag (.ias_trigger ["Load more items"]) of B instance disappears by $(window) scroll of A.
"scrollContainer" of A instance: $(window)
"scrollContainer" of B instance: $('Unique ID')
It seems that trigger tag of IAS has CLASS (.ias_trigger) not ID.
Question1: Is the multiple instance impossible in one page?
Question2: Can I deal by onScroll() callback?
Best regards.
The text was updated successfully, but these errors were encountered: