Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- /* Bind the touchevent (if touch events exist)
- -------------------------------------------------------------- */
- if (Modernizr.touch) $(document).bind('mouseup touchend', mobileInfscr);
- /* Infinite Scroll
- -------------------------------------------------------------- */
- $('#article-grid').infinitescroll({
- navSelector: '#page-nav',
- nextSelector: '#page-nav a',
- itemSelector: 'div.article',
- loadingText: 'Loading the next page',
- loadingMsgRevealSpeed : 0,
- animate: false,
- extraScrollPx: 0,
- donetext: 'No more pages to load',
- bufferPx: 80,
- debug: false
- });
- /* Event fired on touchevent
- -------------------------------------------------------------- */
- function mobileInfscr() {
- setTimeout(function() {
- var documentHeight = $(document).height();
- var scrollHeight = $(window).scrollTop();
- var distanceLeft = documentHeight - scrollHeight;
- if (distanceLeft < 500) {
- $(document).trigger('retrieve.infscr');
- }
- }, 400)
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement