复位/ AJAX调用后禁止使用无限滚动 [英] Reset / disable infinite scroll after AJAX call

查看:137
本文介绍了复位/ AJAX调用后禁止使用无限滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用无限的ajax滚动 ( https://github.com/webcreate/infinite-ajax-scroll )插件与过滤。我有无限的滚动工作的过滤器,但我的问题是,每当滚动得到它不再滚动,即使选择了其它过滤器的结果一个过滤器的结尾。因此,我需要在选择过滤器复位infinate滚动,但我找不到任何地方关于如何重置此文档中,我不伟大与jQuery,因此不能想出解决办法。

我也有一定的过滤器,不需要inifiniate滚动,也需要AA方法来禁用它的。

  $('过滤器')。点击(函数(){
    //莫名其妙重置卷轴
    //setTimeout("jQuery.ias({container:#container的'}),1000);
    变量$此= $(本);
    变种的URL = $ this.attr('的href');
    loadMoreItems(URL,$本);
});
返回false;
});

jQuery.ias({
    集装箱:#container的',//主容器中的数据去追加
    资料:.element',//单品
    分页:.paginate',//页面导航
    下一篇:.paginate一',//翻页选择
    装载机:'< IMG SRC =公共/ IMG / AJAX-loader.gif/>',
    noneleft:没有更多的折扣,您的选择,
    triggerPageThreshold:'10',
    触发:加载更多的项目,
    历史:假的,
    thresholdMargin:-350
});
 

解决方案

其他的有同样的问题,因为你的;据笔者,这是目前不可能干净地重新初始化IAS。

所以,你的选择似乎是

通过

1)硬重置插件删除事件处理程序并调用 jQuery.ias({...})每一次的筛选已发生更改时间

2)切换到不同的库。在bug报告用户写了他自己 - 也许他的解决办法是使用你的

I am using infinite-ajax-scroll (https://github.com/webcreate/infinite-ajax-scroll) plugin with filtering. I have the filters working with the infinite scroll but my issue is, whenever the scroll get the the end of the results for one filter it will no longer scroll, even after another filter is selected. I therefore need to reset the infinate scroll when the filter is selected but I cannot find anywhere in the documentation on how to reset this and am not great with JQuery and so cannot figure this out.

I also have certain filters that don't need inifiniate scroll and would also need a a way to disable it for those.

$('.filter a').click(function() {
    //reset scroll somehow
    //setTimeout("jQuery.ias({container: '#container'})",1000);
    var $this = $(this);
    var URL = $this.attr('href');
    loadMoreItems(URL, $this);
});
return false;
});

jQuery.ias({
    container: '#container', // main container where data goes to append
    item: '.element', // single items
    pagination: '.paginate', // page navigation
    next: '.paginate a', // next page selector
    loader: '<img src="public/img/ajax-loader.gif"/>', 
    noneleft: 'No more discounts for your selection', 
    triggerPageThreshold: '10', 
    trigger: "Load more items",
    history: false, 
    thresholdMargin: -350
});

解决方案

Others have had the same issue as you; according to the author, it's currently not possible to cleanly re-initialize IAS.

So your options seem to be

1) hard-reset the plugin by removing the event handlers and calling jQuery.ias({...}) again every time the filter has changed

2) switch to a different library. The user in that bug report wrote his own - maybe his solution is of use to you

这篇关于复位/ AJAX调用后禁止使用无限滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆