www.webdeveloper.com
Results 1 to 3 of 3

Thread: knowing when scrollbars pop in?? (or out)??

  1. #1
    Join Date
    Feb 2009
    Location
    UK
    Posts
    142

    knowing when scrollbars pop in?? (or out)??

    THis is ancilliary to the thread
    http://www.webdeveloper.com/forum/sh...d.php?t=232740

    Where my solution was to increase the height of an IFRAME incrementally (or binary chop) until the vertical scrollbar disappeared. At that point the frame would be the same height as the content.

    I can do this for IE5.5 but the code (see link) doesn't work for Mozilla/FF etc engines.

    So any ideas oon how to KNOW when the scrollbar (in auto mode) is popping in &/or out?

    I can force the scrollbars on and off, that is not what is wanted.

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    142
    looks like I have achieved the primary goal.
    FF/Mozilla seems to work as in the suggestion in the thread link above.
    IE 5.5 - IE7 needs the wheeze whereby the height of the IFRAME is incremented from 80 pixels until the "clientWidth" changes (indicating no scroll bar) and then stops.
    This works as JavaScripted until the window is resized. When only FF will correct the situation. This could be covered by a trap based on onReSize (or something) but it has not been implemented yet. see:
    http://www.users.waitrose.com/~cresby/fcctest3.htm
    for results. I will post the important code soon.

  3. #3
    Join Date
    Feb 2009
    Location
    UK
    Posts
    142
    solution
    Code:
    var timcount; 
    // these are set elsewhere to inhibit the test routine while other processes are in progress
    var pagedone = true;
    // bw.ie = "browser window is IE". not true if Mozilla engine detected.
    // a is 1 for the first instance in any given cycle & when repeatedly called from the timer it is 0 as seen below
    function test(a){
     if(pagedone && !timcount) {
     var frameElement = parent.document.getElementById("listdis"); // my IFRAME
     if(!bw.ie) frameElement.style.height = frameElement.contentWindow.document.body.offsetHeight+50; 
     if(bw.ie) { // case IE
      if(a==1) {frameElement.style.height = 60; inc = 50; timrep=10;}
      neww = frameElement.contentWindow.document.body.clientWidth;
      frameElement.style.height = frameElement.contentWindow.document.body.offsetHeight+inc;  // increment by 50 or 0
     if (neww!=frameElement.contentWindow.document.body.clientWidth) {inc = 0; timrep=2000;} //stop incrementing & slow down
     }
     }
     setTimeout("test(0)", timrep);
     fred = fred;
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles