0
votes

I'm using infinite scroll on my website, but i'm facing a problem. On some categories the infinite scroll works just fine, on some other i keep getting a message "Your nextSelector found no elements", even when the pagination > 1 page.

Working Category: http://192.185.242.52/opsinews/category/kinonia/

Non-working Category: http://192.185.242.52/opsinews/category/psichologia-metafisiki/

This is the code i'm using to generate the pagination:

// Custom Pagination by KRIESI

function kriesi_pagination($pages = '', $range = 2) {
$showitems = ($range * 2)+1;

 global $paged;
 if(empty($paged)) $paged = 1;

 if($pages == '')
 {
     global $wp_query;
     $pages = $wp_query->max_num_pages;
     if(!$pages)
     {
         $pages = 1;
     }
 }   

 if(1 != $pages)
 {
     echo "<div class='pagination'>";
     if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
     if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";

     for ($i=1; $i <= $pages; $i++)
     {
         if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
         {
             echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."'

class='inactive' >".$i.""; } }

     if ($paged < $pages && $showitems < $pages) echo "<a class='next_link' href='".get_pagenum_link($paged +

1)."'>›";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "»"; echo "\n"; } }

and this is the code to initialise the infinite scroll:

/* Loading...\",\"finishedMsg\":\"No additional posts.\",\"img\":\"http:\\\/\\\/174.132.169.16\\\/opsinews\\\/wp-content\\\/plugins\\\/infinite-scroll\\\/img\\\/ajax-loader.gif\"},\"nextSelector\":\"a.next_link\",\"navSelector\":\".pagination\",\"itemSelector\":\".article-item\",\"contentSelector\":\".article-items-wrapper\",\"debug\":true,\"behavior\":\"\",\"callback\":\"\\t\\t\\\/* Lazyload *\\\/\\r\\n\\t\\t$(\\\"img.lazy\\\").lazyload({\\r\\n\\t\\t\\teffect : \\\"fadeIn\\\",\\r\\n\\t\\t\\tthreshold : 200,\\r\\n\\t\\t\\tfailure_limit : 10\\r\\n\\t\\t});\"}"; /* ]]> */
1

1 Answers

0
votes

you have a javascript error on one of the pages, with then prevents further javascript. your error is here

//remember dropdown
var drop = document.getElementById('time_entry_activity_id');
drop.onchange = function(){
GM_setValue("job", drop.options[drop.selectedIndex].text);
} 

try and check first if drop is an object, try something like this

if (drop != null && drop.value == '') {
   ..... your code ....
}