Dustin
Dustin

Reputation: 4459

InfiniteScroll callback after loading each section of content

I have a webpage that has about 50 audio players on it. I want to use InfiniteScroll to only load about 10 of the players at a time as the user scrolls. The problem I'm having is that I am using an HTML5 audio plugin called MediaElement.js and that plugin does not get applied to the new players that load into my page. What I'm looking for is a way to do a callback after each section of content loads so that I can possibly initialise MediaElement.js again so it gets applied to all of the newly loaded audio elements.

I've tried to make this work with the following option for InfiniteScroll but it only seems to load when I first load the page.. not when each section of content loads into the page.

// Just a testing function
function test() {
    console.log("test");
}

// snippet of the finished option for InfiniteScroll..
loading: {
  finished: test()
}

Upvotes: 0

Views: 1287

Answers (1)

Asherlc
Asherlc

Reputation: 1161

You need to send in the function reference without parenthesis

// Just a testing function
function test() {
    console.log("test");
}

// snippet of the finished option for InfiniteScroll..
loading: {
  finished: test
}

Upvotes: 1

Related Questions