From b7fad8ca3ea6abfcbe571219243b1de8bc5f924f Mon Sep 17 00:00:00 2001 From: Dave Sparks Date: Thu, 29 Apr 2021 21:52:01 +1000 Subject: [PATCH] fix destroy function --- src/js/jquery.smartTab.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/jquery.smartTab.js b/src/js/jquery.smartTab.js index 2b81b00..dd52804 100644 --- a/src/js/jquery.smartTab.js +++ b/src/js/jquery.smartTab.js @@ -595,7 +595,12 @@ let instance = $.data(this[0], 'smartTab'); if (options === 'destroy') { - $.data(this, 'smartTab', null); + if (instance != null) { + instance.tabs.off("click"); + instance.main.data('click-init', false) + $.data(this[0], 'smartTab', null); + } + return this; } if (instance instanceof SmartTab && typeof instance[options] === 'function') {