Fix for “Jumpy” Fixed Background in IE and Edge

if (document.documentMode || /Edge/.test(navigator.userAgent)) { // if IE or Edge $('body').on("mousewheel", function () { // remove default behavior event.preventDefault(); //scroll without smoothing var wheelDelta = event.wheelDelta; var currentScrollPosition = window.pageYOffset; window.scrollTo(0, currentScrollPosition - wheelDelta); }); }
“If you are using fixed backgrounds on your website, you may experience issues on IE.
Your fixed backgrounds may jump around and jitter when scrolling with mousewheel.
A way to fix this is to disable smooth scrolling on IE, but it won’t help your users.
So another way is to fix it by overriding the mousewheel event on IE.”

Source: https://coderwall.com/p/hlqqia/ie-fix-for-jumpy-fixed-bacground

Modified UA detection to also recognize MS Edge.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.