Destroy iScroll Object

I create an iScroll object:

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

The scroller appears in the DOM.

I'm trying to destroy it:

this.bodyScroll.destroy();

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

+4
source share
1 answer

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

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

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

Source: https://habr.com/ru/post/1548081/


All Articles