infinite scroll manual trigger

瘦欲@ 提交于 2019-11-30 02:36:11
inTOWN

Pfoe, found it... Long live good documentation (NOT with this plugin!)

This:

 jQuery('#next a').click(function(){
    jQuery('#next a').infinitescroll('retrieve.infscr');
 return false;
});

Should be:

jQuery('#next a').click(function(){
    jQuery('ul#infinite').infinitescroll('retrieve');
 return false;
});

the biggest problem was the .infscr which shouldn't be there.. Hope it helps someone else..

Documentation-like solution:

jQuery("#clickable_element").click(function(){
    jQuery('#main_content_container').infinitescroll('retrieve');
        return false;
});

Note:
You may have to add the manual trigger behavior if you are working with masonry or isotope in order to make it work. Just include manual-trigger.js after infinitescroll and pass the behavior by passing behavior: 'twitter' when calling the plugin.

I made the following tweak to ensure the navigation link showed up after being clicked the first time:

jQuery("#clickable_element").click(function(){
    jQuery('#main_content_container').infinitescroll('retrieve');
    jQuery('#pagination').show();
    return false;
});

Maybe... $('#next a').click(); ?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!