This commit is contained in:
Abhishek Kathuria 2022-08-30 19:00:52 +05:30
parent d273914769
commit d39f37bf24
1 changed files with 26 additions and 0 deletions

View File

@ -289,9 +289,35 @@
setTimeout(function() {
document.getElementById('product-form').submit();
}, 0);
} else {
this.activateAutoScroll();
}
});
},
activateAutoScroll: function(event) {
/**
* This is normal Element
*/
const normalElement = document.querySelector(
'.control-error:first-of-type'
);
/**
* Scroll Config
*/
const scrollConfig = {
behavior: 'smooth',
block: 'end',
inline: 'nearest',
}
if (normalElement) {
normalElement.scrollIntoView(scrollConfig);
return;
}
}
}
});