We have created a Stepper which works great when built locally, but when building for production and minify are applied it does not work anymore. Pushing "continue" will results in nothing happening. No errors in web console either. Im very confused :D
"use strict";
// Class definition
var OnBoarding = function () {
// Private methods
var initStepper = function (elementId) {
// Stepper lement
var element = document.querySelector("#kt_onboard_stepper");
var options = { startIndex: 1 };
if (element != null) {
// Initialize Stepper
var stepper = new KTStepper(element, options);
// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
stepper.goNext(); // go next step
});
// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
stepper.goPrevious(); // go previous step
});
}
}
// Public methods
return {
init: function (elementId) {
initStepper(elementId);
}
}
}();
Hi Remi,
Are you trying to building your application using the "gulp --prod" option? We've looked into this issue and haven't been able to reproduce it on our end.
Also, make sure that you have properly initialized the stepper component. You can refer to the documentation here for guidance:
https://preview.keenthemes.com/html/metronic/docs/general/stepper
If the issue persists, it might be helpful to review your code and configuration to see if there are any discrepancies that might be causing this behavior.
Thanks
Hi Remi,
May I inquire about the method you're using to build and minify your assets? Are you utilizing gulp, webpack, or another build tool for this purpose? This information will help me better understand the context of your issue and provide you with more targeted assistance.
Hello Faizal,
im using Gulp.
I think I got it one step further now.. But im getting Uncaught TypeError: (new KTStepper(...)).on is not a function
"use strict";
// Class definition
var OnBoarding = function () {
// Private methods
var initStepper = function () {
// Stepper lement
var element = document.querySelector("#kt_onboard_stepper");
var options = { startIndex: 1 };
// Initialize Stepper
var stepper = new KTStepper(element, options);
// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
stepper.goNext(); // go next step
console.log("stepper.next");
});
// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
stepper.goPrevious(); // go previous step
console.log("stepper.previous");
});
}
// Public methods
return {
init: function () {
initStepper();
}
}
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
OnBoarding.init();
});