MINOR: scrolling back to top after submission
This commit is contained in:
parent
de0375651f
commit
e4e78c063b
|
@ -378,7 +378,9 @@ jQuery(document).ready(($) => {
|
|||
const self = this;
|
||||
|
||||
this.$el = element instanceof $ ? element : $(element);
|
||||
this.userformInstance = this.$el.closest('.userform').data('inst');
|
||||
const $elFormItself = this.$el.closest('.userform');
|
||||
|
||||
this.userformInstance = $elFormItself.data('inst');
|
||||
|
||||
this.$prevButton = this.$el.find('.step-button-prev');
|
||||
this.$nextButton = this.$el.find('.step-button-next');
|
||||
|
@ -387,13 +389,21 @@ jQuery(document).ready(($) => {
|
|||
this.$prevButton.parent().attr('aria-hidden', false).show();
|
||||
this.$nextButton.parent().attr('aria-hidden', false).show();
|
||||
|
||||
// Scroll up to the next page...
|
||||
const scrollUpFx = function (e) {
|
||||
const scrollTop = $elFormItself.offset();
|
||||
$('html, body').animate({scrollTop: scrollTop.top}, 'slow');
|
||||
}
|
||||
|
||||
// Bind the step navigation event listeners.
|
||||
this.$prevButton.on('click', (e) => {
|
||||
e.preventDefault();
|
||||
scrollUpFx(e);
|
||||
self.$el.trigger('userform.action.prev');
|
||||
});
|
||||
})
|
||||
this.$nextButton.on('click', (e) => {
|
||||
e.preventDefault();
|
||||
scrollUpFx(e);
|
||||
self.$el.trigger('userform.action.next');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue