Slidebars icon indicating copy to clipboard operation
Slidebars copied to clipboard

exit method won't unbind css method.

Open wonsuc opened this issue 9 years ago • 2 comments

slidebars

My website is responsible website, so if the screen became wider, i should call 'exit' method as described on Slidebars document.

After I called 'exit' method slidebars throws strange error. slidebars.js:173 Uncaught Slidebars hasn't been initialized.

I investigated code, and I found the 'css' method is bound to window resize event.

I think 'exit' method should unbind 'css' method. And also when binding 'css' method to window rezise event, namespace should be uses with it. I tried to unbind 'css' method with manual way, it is really hard to unbind specific method without namespace via jQuery.

wonsuc avatar Feb 05 '17 12:02 wonsuc

Hi,

I have a similar issue with "Uncaught Slidebars hasn't been initialized" When I resize the browser. How did you fix this in the end?

jonny-harte avatar Mar 01 '19 16:03 jonny-harte

@wonsuc @hartey11 Keep in mind that if you trigger exit without having initialized Slidebars it will throw this error. Might be a good idea to check isActive() first.

if ( slidebarsInstance.isActive() ) {
    slidebarsInstance.exit();
}

And also for initializing:

if ( ! slidebarsInstance.isActive() ) {
    slidebarsInstance.init();
}

JoryHogeveen avatar Mar 04 '19 13:03 JoryHogeveen