By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Scrolling DIV's not working in Firefox!!!!

P: 2
Hi All,

I need a scrolling DIV is a to display my dynamic tree in left frame.
In my jsp , Div overflow is set to "auto"
[HTML]<DIV id=divScroller style="overflow:auto;height:200px">
<!-- stuff goes here -->
</DIV
[/HTML]
I'm using beleow function to set the height ..

Expand|Select|Wrap|Line Numbers
  1. function resizeVerticalDiv(oDiv, oBottomNeighbor) {
  2.       var iMinHeight = 100;    //DIV won't get smaller than this
  3.       var iClientHeight = document.body.clientHeight;
  4.          //the browser's viewable area
  5.  
  6.       // find the absolute top coordinate
  7.       var iAbsoluteYTop = oDiv.offsetTop;
  8.       var oParent = oDiv.offsetParent;
  9.       while (oParent.tagName.toUpperCase()!= "BODY") {
  10.          iAbsoluteYTop += oParent.offsetTop;
  11.          oParent = oParent.offsetParent;
  12.       }
  13.  
  14.       // find the absolute bottom coordinate
  15.       var iAbsoluteYBottom;
  16.       if (oBottomNeighbor != null) {
  17.          var iNeighborTop = oBottomNeighbor.offsetTop;
  18.          oParent = oBottomNeighbor.offsetParent;
  19.          while (oParent.tagName.toUpperCase()!= "BODY") {
  20.             iNeighborTop += oParent.offsetTop;
  21.             oParent = oParent.offsetParent;
  22.          }
  23.          iAbsoluteYBottom = document.body.scrollHeight - iNeighborTop
  24.       } else {
  25.          iAbsoluteYBottom = 0
  26.       }
  27.  
  28.       var iNewHeight = document.body.clientHeight - iAbsoluteYTop -
  29.          iAbsoluteYBottom;
  30.       oDiv.style.posHeight = (iNewHeight >= iMinHeight ? iNewHeight :
  31.          iMinHeight);
  32.    }

Calling this fun ction on BODY onLoad and passing my scrolling DIV as the first argument and the ID of the first object below the DIV as the second argument.

This function is not working Firefox. In IE it's working fine.Can anyone please help me to solve this problem??

Thanks,
Geetha.
Jan 16 '08 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
Calling this fun ction on BODY onLoad and passing my scrolling DIV as the first argument and the ID of the first object below the DIV as the second argument.
If you pass the ID of the object, it won't become an object unless you use document.getElementById(oBottomNeighbor).
Jan 16 '08 #2

P: 2
If you pass the ID of the object, it won't become an object unless you use document.getElementById(oBottomNeighbor).

Hi,

Solved pbm by adujusting the stlye property of <div> tag... :-)


Thanks,
Geetha.
Jan 18 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Glad you got it working. Post again if you have any more questions and hopefully someone should be around to answer them.
Jan 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.