{"id":6103,"date":"2014-04-13T02:23:46","date_gmt":"2014-04-13T02:23:46","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/laravel-and-infinite-scroll-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:45:33","modified_gmt":"2022-08-30T15:45:33","slug":"laravel-and-infinite-scroll-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/laravel-and-infinite-scroll-collection-of-common-programming-errors\/","title":{"rendered":"Laravel and Infinite Scroll-Collection of common programming errors"},"content":{"rendered":"<p>I have a question about laravel pagination and infinite scroll :<\/p>\n<p>First of all, I have this :<\/p>\n<pre><code>   \n\n\n\n    @forelse($duels-&gt;results as $d)\n\n        \n\n            @include('versus.versus')\n\n        \n\n\n\n    @empty\n\n\n\n    @endforelse\n\n\n\n\n    \n        {{$duels-&gt;links()}}\n    \n\n<\/code><\/pre>\n<p>As we can see, I have a div #boxes which contain divs .box . The pagination is set by Laravel and looks like this :<\/p>\n<pre><code>\n    \n        \n            <\/code><\/pre>\n<ul>\n<li class=\"previous_page disabled\"><code>\u00ab Previous<\/code><\/li>\n<li class=\"active\"><code>1<\/code><\/li>\n<li><code>2<\/code><\/li>\n<li class=\"next_page\"><code>Next \u00bb<\/code><\/li>\n<\/ul>\n<pre>\n                  \n      \n\n<\/pre>\n<p><code>So now, I want to put an infinite scroll instead of a pagination. How should I do using https:\/\/github.com\/paulirish\/infinite-scroll ?<\/code><\/p>\n<p><code>I stay here if you have questions !<\/code><\/p>\n<p><code>PS : I've tried a few things but none worked like :<\/code><\/p>\n<pre><code><code>    $('#boxes').infinitescroll({\n    loading: {\n        finished: undefined,\n        finishedMsg: \"<em>Congratulations, you've reached the end of the internet.<\/em>\",\n        msg: null,\n        msgText: \"<em>Loading the next set of posts...<\/em>\",\n        selector: null,\n        speed: 'fast',\n        start: undefined\n    },\n    state: {\n        isDuringAjax: false,\n        isInvalidPage: false,\n        isDestroyed: false,\n        isDone: false, \/\/ For when it goes all the way through the archive.\n        isPaused: false,\n        currPage: 1\n    },\n    debug: false,\n    behavior: undefined,\n    binder: $(window), \/\/ used to cache the selector for the element that will be scrolling\n    nextSelector: \"div.paginate li.active a\",\n    navSelector: \"div.paginate\",\n    contentSelector: null, \/\/ rename to pageFragment\n    extraScrollPx: 0,\n    itemSelector: \"div.notizy\",\n    animate: false,\n    pathParse: undefined,\n    dataType: 'html',\n    appendCallback: true,\n    bufferPx: 40,\n    errorCallback: function () { },\n    infid: 0, \/\/Instance ID\n    pixelsFromNavToBottom: undefined,\n    path: undefined, \/\/ Can either be an array of URL parts (e.g. [\"\/page\/\", \"\/\"]) or a function that accepts the page number and returns a URL\n    prefill: false, \/\/ When the document is smaller than the window, load data until the document is larger or links are exhausted\n    maxPage:undefined \/\/ to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)\n});\n<\/code><\/code><\/pre>\n<p>Based on the example of the github page (and replacing what should be replace), but there&#8217;s absolutely no effect doing so.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a question about laravel pagination and infinite scroll : First of all, I have this : @forelse($duels-&gt;results as $d) @include(&#8216;versus.versus&#8217;) @empty @endforelse {{$duels-&gt;links()}} As we can see, I have a div #boxes which contain divs .box . The pagination is set by Laravel and looks like this : \u00ab Previous 1 2 Next [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,1],"tags":[],"class_list":["post-6103","post","type-post","status-publish","format-standard","hentry","category-laravel","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6103"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6103\/revisions"}],"predecessor-version":[{"id":8836,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6103\/revisions\/8836"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}