Skip to content

Commit e97624a

Browse files
committed
Merge remote-tracking branch 'origin/MC-35658' into 2.4-develop-pr34
2 parents 38bd0be + 8109a54 commit e97624a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

lib/web/mage/sticky.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ define([
6868
this.element.on('dimensionsChanged', $.proxy(this.reset, this));
6969

7070
this.reset();
71+
72+
// Application of the workaround for IE11 and Edge
73+
this.normalizeIE11AndEdgeScroll();
7174
},
7275

7376
/**
@@ -128,11 +131,27 @@ define([
128131
},
129132

130133
/**
131-
* Facade method that palces sticky element where it should be.
134+
* Facade method that places sticky element where it should be.
132135
*/
133136
reset: function () {
134137
this._calculateDimens()
135138
._stick();
139+
},
140+
141+
/**
142+
* Workaround for IE11 and Edge that solves the IE known rendering issue
143+
* that prevents sticky element from jumpy movement on scrolling the page.
144+
*
145+
* Alternatively, undesired jumpy movement can be eliminated by changing the setting in IE:
146+
* Settings > Internet options > Advanced tab > inside 'Browsing' item > set 'Use smooth scrolling' to False
147+
*/
148+
normalizeIE11AndEdgeScroll: function () {
149+
if (navigator.userAgent.match(/Trident.*rv[ :]*11\.|Edge\//)) {
150+
document.body.addEventListener('mousewheel', function () {
151+
event.preventDefault();
152+
window.scrollTo(0, window.pageYOffset - event.wheelDelta);
153+
});
154+
}
136155
}
137156
});
138157

0 commit comments

Comments
 (0)