سؤال

On the log in page, when I don't input input in fields, the error message displays focusing on the invalid input. The window scrolls upto the invalid field at the same time.

I do not want the window to scroll. Where can I find the code for scrolling?

هل كانت مفيدة؟

المحلول

copy MAGENTO_ROOT/vendor/magento/magento2-base/lib/web/mage/validation.js into app/design/frontend/THEME_ROOT/web/mage/

then comment (start in line 1956)

if (firstActive.length) {
                $('html, body').animate({
                    scrollTop: firstActive.offset().top
                });
                firstActive.focus();
            }

become

if (firstActive.length) {
                /*$('html, body').animate({
                    scrollTop: firstActive.offset().top
                });*/
                firstActive.focus();
            }

or just delete

if (firstActive.length) {

                    firstActive.focus();
                }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top