mirror of
				https://github.com/ZetaKebab/kesper.git
				synced 2025-11-03 23:59:49 +00:00 
			
		
		
		
	💄 Infinite scroll (#316)
* 💄 Infinite scroll closes #314 Adds infinite scroll logic to Casper 2.0 * use jquery min and not slim
This commit is contained in:
		
				
					committed by
					
						
						John O'Nolan
					
				
			
			
				
	
			
			
			
						parent
						
							d6d9711b9d
						
					
				
				
					commit
					0914d43a86
				
			
							
								
								
									
										18
									
								
								assets/js/infinitescroll.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								assets/js/infinitescroll.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
// Code snippet inspired by https://github.com/douglasrodrigues5/ghost-blog-infinite-scroll
 | 
			
		||||
$().ready(function () {
 | 
			
		||||
    var page = 2,
 | 
			
		||||
        blogUrl = window.location,
 | 
			
		||||
        $result = $('.post-feed');
 | 
			
		||||
 | 
			
		||||
    $(window).scroll(function () {
 | 
			
		||||
        if ($(window).scrollTop() + $(window).height() == $(document).height()) {
 | 
			
		||||
            if (page <= maxPages) {
 | 
			
		||||
                $.get((blogUrl + '/page/' + page),
 | 
			
		||||
                function (content) {
 | 
			
		||||
                    $result.append($(content).find('.post').hide().fadeIn(100));
 | 
			
		||||
                    page = page + 1;
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user