Note : I am using jQuery 
You can use the scrollTop property to track the scrolling of the document.
$(".className")[0].ownerDocument.scrollingElement.scrollTop
and then used the disabled attribute to disable the button.
$("button").attr("disabled","");
Below is the complete code to test how it works.
Run the snippet.
var pageTopPosition = $(".long-page")[0].ownerDocument.scrollingElement.scrollTop;
setInterval(function() {
  if (pageTopPosition != $(".long-page")[0].ownerDocument.scrollingElement.scrollTop) {
    $("button").attr("disabled", "");
  } else {
    $("button").removeAttr("disabled");
  }
  pageTopPosition = $(".long-page")[0].ownerDocument.scrollingElement.scrollTop;
}, 100);
.long-page {
  height: 2000px;
}
.popup {
  width: 100%;
  background-color: #FFEFD5;
  color: red;
  text-align: center;
  position: fixed;
  top: 0;
  font-size: 1.5em;
  padding: 15px;
}
<div class="long-page">
</div>
<div class="popup">
  <button>My Button</button>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>