Uncaught TypeError: Cannot read properties of null (reading 'emit')
leveled23 opened this issue · comments
Issue description:
Uncaught TypeError: Cannot read properties of null (reading 'emit')
error after destroying instance after onTransitionEnd event:
slider.events.on('transitionEnd', onTransitionEnd);
function onTransitionEnd(data) {
if(data.displayIndex === 1) {
slider.destroy();
}
}
Quickfix: wrapping the destroy in a setTimeout of 0 seconds.
Demo link/slider setting:
slider = tns({
container: '#slider',
items: 7,
axis: 'vertical',
controls: false,
nav: false,
autoplay: true,
autoplayTimeout: 1000,
autoplayButtonOutput: false,
speed: 1000,
});
Tiny-slider version:
v2.9.4
Browser name && version:
Chrome 97.0.4692.71
OS name && version:
MacOS 12.1 (Monterey)