Skip to main content

Infinite-scroll

shadow

Infinite Scroll allows you to implement dynamic data loading as users scroll through more content. The element allows you to view any content from a selected endpoint without requiring further interaction, such as clicking the "Load more" button or a link to the next page. The component also displays a loader indicator to inform users when new content is being loaded.

Number of items loaded (size)

The size attribute defines the number of items each time new content is loaded.

Card

The Infinite scroll element can be used in combination with any Elements element. For example Card.

Custom data

Atribúty a Vlastnosti

totalPages

DescriptionSets the numeric value used for total-pages.
Attributetotal-pages
Typenumber
Default0

isLoading

DescriptionDefines the list of values managed through is-loading.
Attributeis-loading
Typearray
Default[]

iterate

DescriptionControls how iterate behaves in the component.
Attributeiterate
Typenull
Defaultnull

Eventy

NameDescription
wje-infinite-scroll:click-itemEvent fired when an item is clicked.
wje-infinite-scroll:startEmitted when the wje-infinite-scroll:start event is dispatched.
wje-infinite-scroll:loadEmitted when async content finishes loading.
wje-infinite-scroll:finishEmitted when the wje-infinite-scroll:finish event is dispatched.
wje-infinite-scroll:completeEmitted when the wje-infinite-scroll:complete event is dispatched.

Metódy

getPages

DescriptionFetches the pages from the server.
Signature(page: number) => Promise<object>

hideLoader

DescriptionHides the loader.
Signature() => void

showLoader

DescriptionDisplays the loader element by adding the 'show' class to its class list. This method is useful for indicating a loading or processing state in the UI.
Signature() => void

hasMorePages

DescriptionChecks if there are more pages to load.
Signature(page: number) => boolean

loadPages

DescriptionLoads the pages.
Signature(page: number) => void

addItem

DescriptionAdds item to the managed component collection.
Signature(item: any, place: any) => void

removeItem

DescriptionRemoves item from the current component state.
Signature(item: any) => void

reset

DescriptionResets component state back to its initial values.
Signature() => void

CSS Shadow Parts

NameDescription
loaderThe loader part of the infinite scroll.

CSS Custom Vlastnosti

NameDescription
--wje-infinite-scroll-widthSets the width of the infinite scroll container. his property determines how wide the infinite scroll area will be relative to its parent element. Accepts any valid CSS width value, such as percentages (%), pixels (px), or viewport units (vw). The default value is 100%, which makes it span the full width of its container.
--wje-infinite-scroll-heightDefines the height of the infinite scroll container. This property specifies how tall the infinite scroll area should be. Accepts any valid CSS height value, such as pixels (px), percentages (%), or viewport units (vh). The default value is 300px, providing a fixed height suitable for most use cases.

Sloty

NameDescription
defaultThe default slot for the infinite scroll.