> For the complete documentation index, see [llms.txt](https://docs.infiniteajaxscroll.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.infiniteajaxscroll.com/reference/methods.md).

# Methods

## constructor

| argument  | type            | description                                                                                                                                                                          |
| --------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| container | string\|Element | Selector or Element of the container (see [definitions/concepts](https://github.com/webcreate/infinite-ajax-scroll/blob/master/docs/getting-started/README.md#definitions-concepts)) |
| options   | object          | Configuration for this instance of Infinite Ajax Scroll (see [options](/reference/options.md))                                                                                       |

```js
// import if you use the NPM package (not needed if you use CDN)
import InfiniteAjaxScroll from '@webcreate/infinite-ajax-scroll';

let ias = new InfiniteAjaxScroll('.container', {
  item: '.item',
  next: '.next',
  pagination: '.pagination'
});
```

## bind

This will bind Infinite Ajax Scroll to the scroll and resize events of the scroll container.

## unbind

This will unbind Infinite Ajax Scroll from the scroll and resize events of the scroll container.

## next

This will load the next page manually.

## load

This wil load an url and returns a promise which represents the [`loaded`](/reference/events.md#loaded) event.

| argument | type   | description |
| -------- | ------ | ----------- |
| url      | string | Url to load |

If the request fails, the promise will be rejected with the [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object.

```js
ias.load('http://my-domain.test/page1.html')
  .then((loadedEvent) => {
    console.log('Requested ' + loadedEvent.url + ' successfully');
  })
  .catch((xhr) => {
    console.log('Request failed with ' + xhr.status + ' (' + xhr.statusText + ')');
  });
```

## append

Use this method to append an array of items to the container.

It will return a promise.

| argument | type          | description                                                                                       |
| -------- | ------------- | ------------------------------------------------------------------------------------------------- |
| items    | array         | Array of element to append to the container                                                       |
| parent   | Element\|null | Container to append to. When none given it falls back to the [configured container](#constructor) |

## enableLoadOnScroll

Enables the [`loadOnScroll`](/reference/options.md#loadonscroll) setting on runtime.

## disableLoadOnScroll

Disables the [`loadOnScroll`](/reference/options.md#loadonscroll) setting on runtime.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.infiniteajaxscroll.com/reference/methods.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
