Scroll To Top

Enter a query to search our site. Note that you can use "*" and "?" as wildcards. Enclosing more than one word in double quotes ("CSS Layout") will search for the exact phrase.

PVII Knowledge Base

1. Select a product ...
2. Select category ...
3. Search the Knowledge Base...

Question #88

Is it possible to automatically hide the GeeWizz scroller controls if the scroller does not contain enough content to require scrolling?

The Answer

Prepared Aug. 2002 by Gerry Jacobsen, PVII

In cases where the content is created dynamically, or you are using multiple content layers, there may be times when the rendered content of the scrolling layer is not enough to require scrolling. You can add a special javascript function, P7_setGWcontrols, to your page that will handle this automatically. This example page that demonstrates the automatic display of the control buttons:

GeeWizz auto-hide scroller controls example page

Here are the modification steps:

1. Copy and paste the P7_setGWcontrols function to your page, right after the "P7_runScroller" function in the <script> section of the page.

function P7_setGWcontrols(co){ //v1.0 GW add-on by PVII
  var g,d,dd,h,hh,mt="visible";
  var theCont = new Array();
  //declare the list of control divs to be hidden
  theCont[0] = 'p7sc1Up';
  theCont[1] = 'p7sc1UpBG';
  theCont[2] = 'p7sc1Down';
  theCont[3] = 'p7sc1DownBG';
  theCont[4] = 'p7sc1Reset';
  theCont[5] = 'p7sc1ResetBG';
  if((g=MM_findObj(co))!=null){if(g.p7Scroll){if((d=MM_findObj(g.p7Scroll))!=null){
  if(document.all || document.getElementById){
  h=parseInt(d.offsetHeight);w=parseInt(d.offsetWidth);if(!h){
  h=parseInt(d.style.pixelHeight);w=parseInt(d.style.pixelWidth);}
  }else if(document.layers){h=parseInt(d.clip.height);w=parseInt(d.clip.width);}
  hh=parseInt(g.p7sBot)-parseInt(g.p7sTop);if(h<=hh){mt="hidden";}
  for(i=0;i<theCont.length;i++){if((d=MM_findObj(theCont[i]))!=null){
  dd=(document.layers)?d:d.style;eval("dd.visibility='"+mt+"'");}}}}}
  }

2. Modify the existing "P7_setScroller" function to automatically run the new "P7_setGWcontrols" function.

-Locate the last line of the P7_setScroller function:

g.toMove=true;

-Place your cursor at the end of this line and click the Enter key to create a new line.

-On this new line, enter (copy and paste) this bit of code:

eval("P7_setGWcontrols('"+a+"')");

-The revised function should look like this:

........
  g.p7sLeft=0;g.p7sStar.........>
  g.toMove=true;
  eval("P7_setGWcontrols('"+a+"')");
  }

That's it! Now the scroller will automatically check the rendered height of the current content layer and show or hide the scroller controls as needed.

Back to the questions list