I\'m trying to make background-image fixed.
As you see in my blog, the background-image is moving when scrolling on IE 11.
How can
The previous answer fixed my issue in IE11! However, I had to make a small change so it will also let me refresh the page using F5 (or Ctrl+F5):
//In IE 11 this fixes the issue when scrolling over a photo break without using the scroll bar
if(navigator.userAgent.match(/Trident\/7\./)) {
$('body').on("mousewheel", function () {
event.preventDefault();
var wheelDelta = event.wheelDelta;
var currentScrollPosition = window.pageYOffset;
window.scrollTo(0, currentScrollPosition - wheelDelta);
});
$('body').keydown(function (e) {
var currentScrollPosition = window.pageYOffset;
switch (e.which) {
case 38: // up
e.preventDefault(); // prevent the default action (scroll / move caret)
window.scrollTo(0, currentScrollPosition - 120);
break;
case 40: // down
e.preventDefault(); // prevent the default action (scroll / move caret)
window.scrollTo(0, currentScrollPosition + 120);
break;
default: return; // exit this handler for other keys
}
});
}