Viewing 1 replies (of 1 total)
  • Thread Starter tuskmaster

    (@tuskmaster)

    Maybe change something in this code I have for infinite scroll?

    <script type="text/javascript">
        jQuery(document).ready(function($) {
            var count = 2;
            var total = <?php echo $wp_query->max_num_pages; ?>;
            $(window).scroll(function(){
                    if  ($(window).scrollTop() == $(document).height() - $(window).height()){
                       if (count > total){
                       	  	return false;
                       }else{
                       		loadArticle(count);
                       }
                       count++;
                    }
            }); 
    
            function loadArticle(pageNumber){
                    $('a#inifiniteLoader').show('fast');
                    $.ajax({
                        url: "<?php bloginfo('wpurl') ?>/wp-admin/admin-ajax.php",
                        type:'POST',
                        data: "action=infinite_scroll&page_no="+ pageNumber + '&loop_file=loop',
                        success: function(html){
                            $('a#inifiniteLoader').hide('1000');
                            $("#primary").append(html);    // This will be the div where our content will be loaded
                        }
                    });
                return false;
            }
    
        });
    
    </script>
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Special Recent Posts] Infinite Scroll’ is closed to new replies.