Skip to content

Commit

Permalink
Fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
techlab committed Jul 30, 2022
1 parent 8f58f75 commit e76b32b
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 45 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

v6.0.3
-----
- **Fixed:** Navigation not properly maintained when navigate fast
- **Changed:** Code optimizations

v6.0.1
-----
- **Added:** Support for jQuery Slim version
Expand Down
56 changes: 35 additions & 21 deletions dist/js/jquery.smartWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.3
* The awesome step wizard plugin for jQuery
* http://www.techlaboratory.net/jquery-smartwizard
*
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -282,12 +282,12 @@ 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 theme option
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.themePrefixCss + this.options.theme); // Set the main element

this.main.addClass(this.options.style.mainCss).addClass(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

Expand Down Expand Up @@ -442,20 +442,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);
});
}
}, {
Expand Down Expand Up @@ -560,6 +560,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) {
Expand All @@ -575,6 +577,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) {
Expand All @@ -596,19 +606,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).removeClass(removeCss).addClass(addCss);
} // 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",
Expand Down
Loading

0 comments on commit e76b32b

Please sign in to comment.