Forum Moderators: open

Message Too Old, No Replies

Merging two javascripts to support Gecko

Gecko scroll bug work around...

         

JAB Creations

6:01 am on Jan 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Gecko browsers with the exception of the 1.8 branch and newer (all nightly builds at this point in time) have a scroll bug where you can not use the scroll wheel on fields such as DIVs.

There is a script I have found (bug 97283) that allows a javascript to make the DIV field scroll ... I want to combine that code to work with a DIV that is already rendered in javascript.

Here is the DIV scrollfix...


<script type="text/javascript">
function fixScroll(div) {
var s = div.scrollTop;
div.childNodes[1].focus();
div.scrollTop = s;
}
</script>

DIV with JS Fix...


<div onmouseover="fixScroll(this);"></div>

Here is my code that I want to apply this JS scroll fix to and haven't gotten it to work on my end yet.


<script type="text/javascript">
<!--
function resizeDiv() {
width = document.body.clientWidth-20;

if ((navigator.userAgent.indexOf("Opera 6")!=-1)
¦¦(navigator.userAgent.indexOf("Opera/6")!=-1))
{
height = document.body.clientHeight-20;
}
else if (navigator.userAgent.indexOf("Opera")!=-1)
{
height = document.body.clientHeight-40;
}
else
{
height = document.body.clientHeight-20;
}
document.getElementById('DivBody').style.width = width;
document.getElementById('DivBody').style.height = height; }
document.writeln('<div id="DivBody" class="body">')
resizeDiv();
//-->
</script>

To test the script use any stable release of 1.7.5 or older.

Robin_reala

4:03 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't help you with this, but for people who can help Fx1.0 will also exhibit the same behaviour if you've got that.