diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index e1de8e4..613c6af 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,6 +1,6 @@
# These are supported funding model platforms
-github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+github: techlab
patreon: # Replace with a single Patreon username
open_collective: techlab
ko_fi: # Replace with a single Ko-fi username
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4d98174..4f44800 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,20 @@
CHANGELOG
=========
+
+v6.0.5
+-----
+- **Fixed:** unDoneOnBackNavigation not working https://github.com/techlab/jquery-smartwizard/issues/146
+
+v6.0.4
+-----
+- **Changed:** Code optimizations
+
+v6.0.3
+-----
+- **Fixed:** Navigation not properly maintained when navigate fast
+- **Changed:** Code optimizations
+
v6.0.1
-----
- **Added:** Support for jQuery Slim version
diff --git a/README.md b/README.md
index 4c0d2ac..569dfc5 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,36 @@ Installation
```
+### Common JS/Webpack
+```js
+var $ = require( "jquery" );
+require( "smartwizard/dist/css/smart_wizard_all.css");
+const smartWizard = require("smartwizard");
+
+$(function() {
+ $('#smartwizard').smartWizard();
+});
+```
+### ES6/Babel
+```js
+import $ from "jquery";
+import "smartwizard/dist/css/smart_wizard_all.css";
+import smartWizard from 'smartwizard';
+
+$(function() {
+ $('#smartwizard').smartWizard();
+});
+```
+
+#### Note: you may have to install the required dependencies
+```bash
+npm i jquery
+npm i smartwizard
+
+// If you are using Webpack, install
+npm i webpack webpack-cli style-loader css-loader --save-dev
+```
+
### Download
#### [Download from GitHub](https://github.com/techlab/jquery-smartwizard/archive/master.zip)
@@ -169,14 +199,10 @@ Include SmartWizard plugin JavaScript
```
Initialize the SmartWizard
-```html
-
```
That's it!
diff --git a/dist/js/jquery.smartWizard.js b/dist/js/jquery.smartWizard.js
index 8c227e7..df0e293 100644
--- a/dist/js/jquery.smartWizard.js
+++ b/dist/js/jquery.smartWizard.js
@@ -9,7 +9,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
/*!
-* jQuery SmartWizard v6.0.1
+* jQuery SmartWizard v6.0.5
* The awesome step wizard plugin for jQuery
* http://www.techlaboratory.net/jquery-smartwizard
*
@@ -51,7 +51,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
selected: 0,
// Initial selected step, 0 = first step
theme: 'basic',
- // theme for the wizard, related css need to include for other than default theme
+ // Theme for the wizard, related css need to include for other than default theme
justified: true,
// Nav menu justification. true/false
autoAdjustHeight: true,
@@ -282,12 +282,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
value: function _setElements() {
var _this2 = this;
- // Set the main element
- this.main.addClass(this.options.style.mainCss); // Set theme option
-
+ // Set the main element classes including theme css
this.main.removeClass(function (i, className) {
- return (className.match(/(^|\s)sw-theme-\S+/g) || []).join(' ');
- }).addClass(this.options.style.themePrefixCss + this.options.theme); // Set justify option
+ return (className.match(new RegExp('(^|\\s)' + _this2.options.style.themePrefixCss + '\\S+', 'g')) || []).join(' ');
+ }).addClass(this.options.style.mainCss + ' ' + this.options.style.themePrefixCss + this.options.theme); // Set justify option
this.main.toggleClass(this.options.style.justifiedCss, this.options.justified); // Set the anchor default style
@@ -442,20 +440,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
_this4._transit(selPage, curPage, stepDirection, function () {
- // Update the current index
- _this4.current_index = idx; // Fix height with content
+ // Fix height with content
+ _this4._fixHeight(idx); // Trigger "showStep" event
- _this4._fixHeight(idx); // Set the buttons based on the step
+ _this4._triggerEvent("showStep", [selStep, idx, stepDirection, _this4._getStepPosition(idx)]);
+ }); // Update the current index
- _this4._setButtons(idx); // Set the progressbar based on the step
+ _this4.current_index = idx; // Set the buttons based on the step
- _this4._setProgressbar(idx); // Trigger "showStep" event
+ _this4._setButtons(idx); // Set the progressbar based on the step
- _this4._triggerEvent("showStep", [selStep, idx, stepDirection, _this4._getStepPosition(idx)]);
- });
+ _this4._setProgressbar(idx);
});
}
}, {
@@ -560,6 +558,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
value: function _transit(elmToShow, elmToHide, stepDirection, callback) {
var transitFn = $.fn.smartWizard.transitions[this.options.transition.animation];
+ this._stopAnimations();
+
if ($.isFunction(transitFn)) {
transitFn(elmToShow, elmToHide, stepDirection, this, function (res) {
if (res === false) {
@@ -575,6 +575,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
callback();
}
}
+ }, {
+ key: "_stopAnimations",
+ value: function _stopAnimations() {
+ if ($.isFunction(this.container.finish)) {
+ this.pages.finish();
+ this.container.finish();
+ }
+ }
}, {
key: "_fixHeight",
value: function _fixHeight(idx) {
@@ -596,19 +604,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
key: "_setAnchor",
value: function _setAnchor(idx) {
// Current step anchor > Remove other classes and add done class
- this.steps.eq(this.current_index).removeClass(this.options.style.anchorActiveCss);
+ if (this.current_index !== null && this.current_index >= 0) {
+ var removeCss = this.options.style.anchorActiveCss;
+ var addCss = '';
- if (this.options.anchor.enableDoneState !== false && this.current_index !== null && this.current_index >= 0) {
- this.steps.eq(this.current_index).addClass(this.options.style.anchorDoneCss);
+ if (this.options.anchor.enableDoneState !== false) {
+ addCss += this.options.style.anchorDoneCss;
- if (this.options.anchor.unDoneOnBackNavigation !== false && this._getStepDirection(idx) === 'backward') {
- this.steps.eq(this.current_index).removeClass(this.options.style.anchorDoneCss);
+ if (this.options.anchor.unDoneOnBackNavigation !== false && this._getStepDirection(idx) === 'backward') {
+ removeCss += ' ' + this.options.style.anchorDoneCss;
+ }
}
+
+ this.steps.eq(this.current_index).addClass(addCss).removeClass(removeCss);
} // Next step anchor > Remove other classes and add active class
- this.steps.eq(idx).removeClass(this.options.style.anchorDoneCss);
- this.steps.eq(idx).addClass(this.options.style.anchorActiveCss);
+ this.steps.eq(idx).removeClass(this.options.style.anchorDoneCss).addClass(this.options.style.anchorActiveCss);
}
}, {
key: "_setButtons",
diff --git a/dist/js/jquery.smartWizard.min.js b/dist/js/jquery.smartWizard.min.js
index 90a8c38..30d5aa8 100644
--- a/dist/js/jquery.smartWizard.min.js
+++ b/dist/js/jquery.smartWizard.min.js
@@ -1,6 +1,6 @@
"use strict";function _classCallCheck(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,s){for(var e=0;e