Destroy an iScroll object

3.7k views Asked by At

I create an iScroll object:

this.bodyScroll = new IScroll('body', {
                scrollbars: true
            });

The scroller appears in the DOM.

The I try to destory it:

this.bodyScroll.destroy();

But the scroller is still visiable and in the DOM. Then when I create the iScroll object again, I now have 2 scrollers in the DOM. How do I destroy and remove from DOM?

1

There are 1 answers

0
hari On

iScroll has a method for that: object.destroy()

var scroll_bar = new IScroll('body', {
       scrollbars: true
});

// and when you want to remove it:
scroll_bar.destroy();