Closed Bug 305609 Opened 19 years ago Closed 19 years ago

When scrolling web-page using mouse wheel window.onscroll event isn't fired

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 189308

People

(Reporter: maximgb, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

When scrolling web-page using mouse wheel window.onscroll event isn't fired

Reproducible: Always

Steps to Reproduce:
Use code from Additional Information to reproduce problem. Panel on the page
should stay centered verticaly on the current page viewport.

Actual Results:  
If scroll the test page using scroll bars window.onscroll fires ok, and the
panel stays centered, when scroll using mousewheel - it doesn't fire and the
panel moves  verticaly

Expected Results:  
expected window.onscroll fire

<!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Test window.onscroll</title>
<style type="text/css">
 html
 {
  width: 100%;
  height: 100%;
 }

 body
 {
  width: 100%;
  height: 100%;
 }

 .whole
 {
  width: 100%;
  height: 1000px;
  border: 1px solid red;
 }
  
 .panel
 {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid blue;
  background-color: #CCCCCC;
  padding: 1em;
  width: 200px;
  height: 120px;
  margin-left: -100px;
  margin-top: -60px;
  text-align: center;
 }
</style>
<script type="text/javascript">
 function Init()
 {
   window.onscroll = Scroll;
 }

 function Scroll()
 {
   var p = document.getElementById("panel");
   if (document.body.scrollTop) {
       p.style.top = document.body.scrollTop + document.body.offsetHeight / 2 +
"px";
   }
   else if (window.pageYOffset) {
       p.style.top = window.pageYOffset + document.body.offsetHeight / 2 + "px";
   }
 }
</script>
</head>
<body onload="Init()">
 <div class="whole">
 </div>
 <div class="panel" id="panel">
  Panel
 </div>
</body>

*** This bug has been marked as a duplicate of 189308 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.