PRB: Too Many Onscroll Events When User Scrolls (238004)
The information in this article applies to:
- Microsoft Internet Explorer (Programming) 5
- Microsoft Internet Explorer (Programming) 5.01
- Microsoft Internet Explorer (Programming) 5.5
This article was previously published under Q238004 SYMPTOMS
When a user clicks a scroll bar, Internet Explorer 5 fires multiple onscroll events instead of one as in Internet Explorer 4.
CAUSE
Internet Explorer 5 scrolls an HTML page in small increments, with each one generating a scroll event.
RESOLUTION
You can institute the same behavior in Internet Explorer 5 as occurs in Internet Explorer 4 in the following way: use a global variable flag and test against it when the onscroll event fires. The first time, invoke the code you want and alter the flag; subsequently, do nothing. Use setTimeout to reset the flag in, say, 200 milliseconds to bypass on the subsequent events.
The following pseudocode demonstrates the workaround:
<SCRIPT>
Dim CounterForScroll
Function divNumbers_OnScroll()
If (CounterForScroll = 0) Then
CounterForScroll = CounterForScroll + 1
'... event handler code ...
CountOnScroll = CountOnScroll + 1
txtOnScroll.Value=CountOnScroll
window.setTimeout "Reset()", 200
End If
End Function
Function Reset()
CounterForScroll = 0
End Function
</SCRIPT>
STATUS
This behavior is by design.
REFERENCESFor more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites: For additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
255541 PRB: Fragment Identifiers, ScrollIntoView Fail With Scroll=No
Modification Type: | Major | Last Reviewed: | 12/15/2005 |
---|
Keywords: | kbDHTML kbprb kbSBNWorkshop KB238004 |
---|
|