Prakash Raman
Prakash Raman

Reputation: 13933

Reinitialize iscroll

I am using iScroll4 for my project (http://cubiq.org/iscroll-4)

As my container height changes I would need to reinitialize iscroll for a dom element. Is there anyway I could do that

e.g.

scroller.reset();

Thanks.

Upvotes: 3

Views: 1506

Answers (1)

BenM
BenM

Reputation: 53228

Yes, you need the refresh() function:

iScroll needs to know the correct dimensions of both the wrapper and the scroller. They are computed the first time at start up but if your code changes the elements size, iScroll needs to be warned that you are messing with the DOM.

This is achieved by calling the refresh function with the right timing. Please follow me closely, understanding this will save you hours of scrolling frustration.

You can use it as follows:

myScroll.refresh();

Where myScroll represents the variable to which you initialized iScroll.

Upvotes: 3

Related Questions