I want to disable those tab click scroll down. when clicking on any tab I don't want to scroll on its content
Asked
Active
Viewed 1,450 times
0
-
follow this link:- https://magento.stackexchange.com/questions/293437/magento-2-3-3-tab-jumping-on-top – Ronak Apr 28 '20 at 09:51
2 Answers
1
My temporary solution was changing _scrollToTopIfVisible function in this file
\lib\web\mage\collapsible.js
From
_scrollToTopIfVisible: function (elem) {
if (!this._isElementOutOfViewport(elem)) {
elem.scrollIntoView();
}
},
to
_scrollToTopIfVisible: function (elem) {
if (this._isElementOutOfViewport(elem)) {
elem.scrollIntoView();
}
},
If anyone has other soluation please share
Hope this helps.
Vikas kalal
- 1,251
- 1
- 6
- 25
1
Best way is to create a mixin to overrule the part which makes it scroll.
define([
'jquery',
], function ($) {
'use strict';
return function (target) {
$.widget('mage.collapsible', target, {
_create: function () {
this.storage = $.localStorage;
this.icons = false;
if (typeof this.options.icons === 'string') {
this.options.icons = JSON.parse(this.options.icons);
}
this._processPanels();
this._processState();
this._refresh();
if (this.options.icons.header && this.options.icons.activeHeader) {
this._createIcons();
this.icons = true;
}
// Removed block which make scroll to top
this._bind('click');
this._trigger('created');
}
});
return $.mage.collapsible;
};
});
I made a feature request to make this configurable/optional. https://github.com/magento/magento2/issues/38382
Akif
- 1,531
- 2
- 24
- 46
