Actions  -  Centering

In order to center a CSS page which uses DHTML Actions

 create an Action for this page by following the Recipe below:

When -> Page -> Page Loaded

click on the "Scripted Action" button and enter the following code into the Scripted Actions window:

 var layoutWidth = XXX;
   if(F_NN) {
       var bodyWidth = window.innerWidth;
       var theOffset = (bodyWidth - layoutWidth)/2;
       if(theOffset > 0) {
   document.layers['LayoutLYR'].left=theOffset;
   }
   } else {
       var bodyWidth = document.body.offsetWidth;
       var theOffset = (bodyWidth - layoutWidth)/2;
       if(theOffset > 0) {
       document.all.tags('DIV') ['LayoutLYR'].style.left=theOffset;
     }
   }

where xxx is the size of the page (MasterBorder and Layout)

The effect will be that the page will load, then move into "Centering" position. If you want, you may want to "hide" the layout area, perform this Action, then show the page using Object -> Show

Here’s a demo of the Scripted Action above

Note:  All Actions described in this section have been tested with Fusion 3.x, 4.x, 5.x and MX.
           Actions will not currently work properly when viewed with Netscape 6.0

Go Back to Previous Page

Have a question that you canīt find the answer to? Want to report a possible bug?

Send a help request to NetObjects Technical Support