You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let infScroll = new InfiniteScroll( '.container', {...});
139
-
});
140
-
```
141
-
142
-
<p>To use Infinite Scroll as a jQuery plugin with RequireJS and infinite-scroll.pkgd.js, you need to call <ahref="https://github.com/desandro/jquery-bridget">jQuery Bridget</a>.</p>
<p>Or, you can require Infinite Scroll's index.js by using a package manager: npm, Bower, or Yarn. Set <code>baseUrl</code> to the package install path and set a config path for all your application code.</p>
160
-
161
-
``` js
162
-
requirejs.config({
163
-
baseUrl: 'node_modules/', // npm install path
164
-
paths: {
165
-
app: '../'
166
-
},
167
-
});
168
-
169
-
requirejs( [
170
-
'infinite-scroll/js/index',
171
-
'app/my-component.js',
172
-
], function( InfiniteScroll, myComp ) {
173
-
let infScroll = new InfiniteScroll( '.container', {...});
174
-
});
175
-
```
176
-
177
-
<p>You can require dependencies and use Infinite Scroll as a jQuery plugin with jQuery Bridget.</p>
178
-
179
-
``` js
180
-
requirejs.config({
181
-
baseUrl: 'node_modules/',
182
-
paths: {
183
-
jquery: 'jquery/jquery'
184
-
},
185
-
});
186
-
187
-
requirejs( [
188
-
'jquery',
189
-
'infinite-scroll/js/index',
190
-
'jquery-bridget/jquery-bridget',
191
-
],
192
-
function( $, InfiniteScroll ) {
193
-
// make Infinite Scroll a jQuery plugin
194
-
$.bridget( 'infiniteScroll', InfiniteScroll, $ );
195
-
// now you can use $().infiniteScroll()
196
-
$('.container').infiniteScroll({...});
197
-
});
198
-
```
199
-
200
-
<p>Infinite Scroll does not include <code>imagesLoaded</code>, which is required to use <ahref="options.html#outlayer"><code>outlayer</code></a>. You will need to install and require <code>imagesLoaded</code> separately.</p>
Use <ahref="options.html#append"><code>append</code></a> to select items to append.</li>
558
-
<li><code>nextSelector</code>:
559
-
Set <ahref="options.html#path"><code>path</code></a> to a selector string of a link to the next page to use its <code>href</code> value.
560
-
Use <ahref="options.html#hideNav"><code>hideNav</code></a> to hide navigation.</li>
561
-
<li><code>binder</code>:
562
-
Use <ahref="options.html#elementscroll"><code>elementScroll</code></a> to scroll within an element.</li>
563
-
<li><code>path</code>:
564
-
<ahref="options.html#path"><code>path</code></a> works differently.</li>
565
-
<li><code>pathParse</code>:
566
-
Use <ahref="options.html#path"><code>path</code></a>.</li>
567
-
<li><code>prefill</code>:
568
-
<ahref="options.html#prefilll">Backwards compatible</a>, works in v3.</li>
569
-
<li><code>dataType</code>:
570
-
Use <ahref="options.html#responsetype"><code>responseType</code></a> to load data content like JSON.</li>
571
-
<li><code>animate</code> & <code>extraScrollPx</code>:
572
-
Scrolling animation has been removed in v3.</li>
573
-
<li><code>maxPage</code>:
574
-
removed in v3. Use conditional event logic, like in <ahref="#scroll-2-pages-then-load-with-button">scroll 2 pages then button example</a>.</li>
575
-
<li><code>appendCallback</code>:
576
-
Use <ahref="events.html#append"><code>append</code> event</a>.</li>
577
-
<li><code>errorCallback</code>:
578
-
Use <ahref="events.html#error"><code>error</code> event</a>.</li>
579
-
<li><code>debug</code>:
580
-
<ahref="options.html#debug">Backwards compatible</a>, works in v3.</li>
581
-
<li><code>loading</code>
582
-
<ul>
583
-
<li><code>finished</code>:
584
-
Use <ahref="events.html#load"><code>load</code> event</a>.</li>
585
-
<li><code>finishedMsg</code>:
586
-
Use <ahref="options.html#status"><code>status</code></a> and set message HTML in <code>.infinite-scroll-error</code> and <code>.infinite-scroll-last</code>.</li>
587
-
<li><code>img</code> & <code>msgText</code>:
588
-
Use <ahref="options.html#status"><code>status</code></a> and set loading HTML in <code>.infinite-scroll-request</code>.</li>
<p>The one breaking change is that Infinite Scroll v4 removed <code>responseType</code> option in favor of <ahref="options.html#responsebody"><code>responseBody</code></a>. This change effects loading JSON in particular. To load JSON with Infinite Scroll v4, set <code>responseBody: <spanclass="comment">'json'</span></code> in your options. Then the <code>body</code> argument in the load event will be <i>JSON</i>.</p>
611
434
612
-
<h3>v2 upgrade example</h3>
613
-
614
-
<divclass="duo example">
615
-
<divclass="duo__cell example__code">
435
+
<divclass="duo">
436
+
<divclass="duo__cell">
616
437
``` js
617
-
// Infinite Scroll v2
618
-
$('.container').infinitescroll({
619
-
itemSelector: '.post',
620
-
nextSelector: '.pagination__next',
621
-
loading: {
622
-
img: '/loading.gif',
623
-
msgText: 'Loading...',
624
-
finished: 'Congratulations, you have reached the end of the internet',
<p>Creating a reduced test case is the best way to debug problems and report issues. Read <ahref="https://css-tricks.com/reduced-test-cases/">CSS Tricks</a> on why they’re so great.</p>
674
503
675
-
<p>Create a reduced test case for Infinite Scroll by forking any one of the <ahref="https://codepen.io/desandro/pens/tags/?selected_tag=infinite-scroll-v3-docs">CodePen demos</a> from these docs.</p>
504
+
<p>Create a reduced test case for Infinite Scroll by forking any one of the <ahref="https://codepen.io/desandro/pens/tags/?selected_tag=infinite-scroll-v4-docs">CodePen demos</a> from these docs.</p>
676
505
677
506
<ul>
678
507
<li>A reduced test case clearly demonstrates the bug or issue.</li>
0 commit comments