diff --git a/cps/static/js/main.js b/cps/static/js/main.js index c04ec65e..ff9cac08 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -172,32 +172,33 @@ $(function() { layoutMode : "fitColumns" }); - - var $loadMore = $(".load-more .row").infiniteScroll({ - debug: false, - // selector for the paged navigation (it will be hidden) - path : ".next", - // selector for the NEXT link (to page 2) - append : ".load-more .book" - //animate : true, # ToDo: Reenable function - //extraScrollPx: 300 - }); - $loadMore.on( "append.infiniteScroll", function( event, response, path, data ) { - $(".pagination").addClass("hidden"); - $(".load-more .row").isotope( "appended", $(data), null ); - }); - - // fix for infinite scroll on CaliBlur Theme (#981) - if ($(".load-more .row").length && $("body").hasClass("blur")) { - $(".col-sm-10").bind("scroll", function () { - if ( - $(this).scrollTop() + $(this).innerHeight() >= - $(this)[0].scrollHeight - ) { - $loadMore.infiniteScroll("loadNextPage"); - window.history.replaceState({}, null, $loadMore.infiniteScroll('getAbsolutePath')+1) - } + if ($('.next').length) { + var $loadMore = $(".load-more .row").infiniteScroll({ + debug: false, + // selector for the paged navigation (it will be hidden) + path : ".next", + // selector for the NEXT link (to page 2) + append : ".load-more .book" + //animate : true, # ToDo: Reenable function + //extraScrollPx: 300 }); + $loadMore.on( "append.infiniteScroll", function( event, response, path, data ) { + $(".pagination").addClass("hidden"); + $(".load-more .row").isotope( "appended", $(data), null ); + }); + + // fix for infinite scroll on CaliBlur Theme (#981) + if ($("body").hasClass("blur")) { + $(".col-sm-10").bind("scroll", function () { + if ( + $(this).scrollTop() + $(this).innerHeight() >= + $(this)[0].scrollHeight + ) { + $loadMore.infiniteScroll("loadNextPage"); + window.history.replaceState({}, null, $loadMore.infiniteScroll('getAbsolutePath')+1) + } + }); + } } $("#restart").click(function() {