Skip to content

Instantly share code, notes, and snippets.

@jekey123
Last active February 7, 2018 20:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jekey123/b81d96796cb7c7f79eb2c5ea303d4221 to your computer and use it in GitHub Desktop.
Save jekey123/b81d96796cb7c7f79eb2c5ea303d4221 to your computer and use it in GitHub Desktop.
Ultimate Member Infinite Scroll Member Directory
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.1.0/jquery.infinitescroll.min.js" defer="defer"></script>
<script type="text/javascript">
(function() {
function waitDefer(method) {
if (window.jQuery && window.jQuery.fn.infinitescroll)
method();
else
setTimeout(function() { waitDefer(method) }, 50);
}
waitDefer(function() {
var grid = jQuery(".um-members");
if (grid.length) {
jQuery('.um-members-pagi').hide();
grid.infinitescroll(
{
navSelector: '.um-members-pagi',
nextSelector: '.um-members-pagi .pagi.current+a',
itemSelector: '.um-member',
loading: {
finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
msgText: "<em>Loading new items...</em>",
speed: 'fast',
}
},
function(new_elts)
{
var elts = jQuery(new_elts).css('opacity', 0);
elts.animate({ opacity: 1 });
grid.masonry('appended', elts);
jQuery('body').trigger('post-load');
grid.masonry('layout');
});
}
});
})();
</script>
@jekey123
Copy link
Author

Simply put this code in footer to activate infinte scroll and get rid of pagination in Ultimate member directory.

@inrobin
Copy link

inrobin commented Jan 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment