-2

I am trying to get the scroll position, the scroll is working in all the browser except ie 11.0

I have tried the below code this is not firing any event

 window.onscroll = function () {
    console.log("Test");
};
Dhamodaran P
  • 177
  • 2
  • 11

1 Answers1

0

Is this issue related with IE browser and SharePoint?

Your above code example is not enough for reproducing the issue.

I try to make a test with this sample code and looks like it is working fine with IE 11 browser.

<!DOCTYPE html>
<html>
<head>
 <title>Page Title</title>
 
 <style>
 #show {
    display:block;
    position:fixed;
    top:0px;
    left:300px;
 }
 </style>
</head>
<body>

<pre id="repeat"></pre>

<div style="position:relative;">
    <div id="show">x</div>
</div>
<script>
 var elem = document.getElementById('repeat');
 var show = document.getElementById('show');

 for (i = 1; i <= 300; i++) {
     elem.innerHTML += i + "<br/>";
 }


 window.onscroll = function () {
     show.innerHTML = document.documentElement.scrollTop || document.body.scrollTop;
 };
 </script>
</body>
</html>

Output in IE 11:

enter image description here

Reference:

Why window onscroll event does not work?

If your issue still persist than please try to provide a clear example with detailed steps which can produce the issue. We will try to make a test with it to check the results.

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19