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

RESOLVED DUPLICATE of bug 189308

Status

()

Firefox
General
RESOLVED DUPLICATE of bug 189308
13 years ago
13 years ago

People

(Reporter: Maxim Bazhenov, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
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
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.