<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="/lib/xsl/devedge-1.00/article_en.xsl"?>
<nde:article 
  url="/toolbox/examples/2002/xb/xbPositionableElement/" 
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:nde="http://devedge.netscape.com/2002/de"
  xmlns:ent="http://devedge.netscape.com/2003/ent"
  xml:lang="en"
  >

 <nde:header>

   <nde:title>
      Class xbPositionableElement
   </nde:title>

   <nde:category>
     Manpage
   </nde:category>

  <nde:pubdate year="2002" month="04" day="21" />
  <nde:moddate year="2003" month="03" day="28" />

  <nde:summary>
      Cross Browser DHTML Positionable Element
  </nde:summary>

  <nde:authlist>
    <nde:author>
      <nde:authname>Doron Rosenberg</nde:authname>
      <nde:authaffil>Netscape Communications</nde:authaffil>
    </nde:author>
    <nde:author>
      <nde:authname>Bob Clary</nde:authname>
      <nde:authaffil>Netscape Communications</nde:authaffil>
    </nde:author>
  </nde:authlist>

  <nde:channels>
    <nde:channel id="examples"/>
    <nde:channel id="xb-2002"/>
  </nde:channels>

</nde:header>


 <nde:head>
 </nde:head>

 <nde:content>
   <h2>Synopis</h2>
   <pre><![CDATA[
class xbPositionableElement
{
public:

xbPositionableElement(String id, 
                      String sideX,
                      String sideY,
                      Number offsetX,
                      Number offsetY);

  // properties
  String id; 
  String name; 
  String sideX;
  String sideY;
  Number offsetX;
  Number offsetY;
  HTMLElement div;  
  Number runId;
  
  // methods
  void start();
  void stop();
  Number _getInnerSize(String propName);
  Number _getScrollOffset(propName);
  Number _updatePosition();
}
  ]]></pre>

    <h2>Source</h2>
    <p>
      <a href="xbPositionableElement.js">xbPositionableElement.js</a>
    </p>

    <h2>Uses</h2>
    <ul>
      <li>nothing</li>
    </ul>

    <h2>See Also</h2>
    
    <ul>
      <li>
        <a href="/toolbox/examples/2002/xb/xbAnimatedElement/">xbAnimatedElement</a>
      </li>
    </ul>

    <h2>Introduction</h2>
    
    <p>
      CSS 2 provides for the ability to position content at a fixed position in
      a browser's window through the use of the CSS rule position: fixed however
      only Netscape Gecko currently supports this advanced CSS 2 feature.
    </p>

    <p>
      xbPositionableElement is an JavaScript Object which provides the ability to
      display an absolutely positioned element at a fixed position in the browser's
      window through the use of DHTML.
    </p>
      
    <h2>Description</h2>
      <h3>Notes</h3>

        <h4>Script Location/Invocation</h4>
        <p>
          xbPositionableElement requires that the HTML Content to be positioned be 
          contained inside of an absolutely positioned HTML Element that has
          a unique ID attribute.
        </p>

        <h4>Cross Browser Support</h4>
        <p>
          Fully supports Gecko based browsers such as Netscape 6.x, Netscape 7.x, CompuServe 7.0
          on all platforms. Supports Internet Explorer 5.5+ on Windows. Supports Opera 5+ on Windows
          and Netscape Navigator 4.x. 
        </p>



    <h2>Properties</h2>
    <dl>

        <dt>
          id
        </dt>
        <dd>
          <p>readonly String - ID Attribute to be given to the
            DIV containing the elements to be positioned.
      </p>
        </dd>

        <dt>
          name
        </dt>
        <dd>
          <p>readonly String - Name of the global variable created
            during construction which holds a reference to the newly created 
            xbPositionableElement object. This is used internally in during the animation using
            the setTimeout function.
          </p>
        </dd>

        <dt>
          runId
        </dt>
        <dd>
          <p>readonly Number - Timer ID for the animation. Returned
            by setTimeout.
          </p>
        </dd>

        <dt>
          sideX
        </dt>
        <dd>
          <p>String - contains the location of where to place the 
            positioned element in dts of the horizontal axis. 
            Can be one of 'left', 'center', or 'right'.
          </p>
        </dd>

        <dt>
          sideY
        </dt>
        <dd>
          <p>String - contains the location of where to place the 
            positioned element in dts of the vertical axis. 
            Can be one of 'top', 'center', or 'bottom'.
          </p>
        </dd>
    
        <dt>
          div
        </dt>
        <dd>
          <p>readonly HTMLElement - reference to the Element which
            contains the HTML that will be positoned. Note that the ID attribute of the element
            will be the ID attribute used in the xbPositionableElement constructor. This ID
            can be used to style the contents using CSS.
          </p>
        </dd>

        <dt>
          styleObj
        </dt>
        <dd>
          <p>readonly Object - reference to the div's stylable 
      object.
          </p>
          <p>
            For DOM HTML and DOM CSS Compatible browsers such as Mozilla, 
            Internet Explorer and Opera this is a reference to div's
      CSS style object.
          </p>
          <p>
            For Navigator 4, this is a reference to the div itself.
          </p>
        </dd>

        <dt>
          refreshInterval
        </dt>
        <dd>
          <p>readonly Number - the number in miliseconds
      to wait before refreshing the position of the div.
          </p>
        </dd>
    
    </dl>

    <h2>Methods</h2>
    <dl>

        <dt>xbPositionableElement(String id, String sideX, String sideY, Number offsetX, Number offsetY)</dt>
        <dd>
          <p>Constructs an instance of the xbPositionableElement class.</p>
            <h3>Arguments:</h3>
            <p>
              String id - ID of the div.
            </p>
          <p>String sideX - contains the 
            location of where to place the 
            positioned element in dts of the horizontal axis. 
            Can be one of 'left', 'center', or 'right'.
          </p>
          <p>String sideY - contains the 
            location of where to place the 
            positioned element in dts of the vertical axis. 
            Can be one of 'top', 'center', or 'bottom'.
          </p>
          <p>Number offsetX - number of pixels
            the element is to be positioned offset in the horizontal direction from
            the geometric position defined by sideX.
            This can be a negative or positive value.
          </p>
          <p>Number offsetY - number of pixels
            the element is to be positioned offset in the vertical direction from
            the geometric position defined by sideY.
            This can be a negative or positive value.
          </p>
          <h3>Returns:</h3>
            <p>nothing</p>
            <h3>Support</h3>
            <p>
              Gecko/Netscape 6+, Internet Explorer 4+, Opera and Navigator 4.
            </p>
        </dd>

        <dt>start()</dt>
        <dd>
            <h3>Returns:</h3>
            <p>
              Nothing
            </p>

          <p>
            This method starts the positioning of the div. This method should be called
            in a page's onload event handler.
          </p>
        </dd>

        <dt>stop()</dt>
        <dd>
          <p>Stops the updating of the div's position</p>
            <h3>Arguments:</h3>
            <p>
              None
            </p>
            <h3>Returns:</h3>
            <p>
              Nothing
            </p>
        </dd>

        <dt>_updatePosition()</dt>
        <dd>
          <p>Internal method used to reposition the Element after changes in the 
            window's size or the scroll position.
          </p>
            <h3>Arguments:</h3>
            <p>
              None
            </p>
            <h3>Returns:</h3>
            <p>
              Nothing
            </p>
        </dd>
    </dl>

    <h2>Examples</h2>

    <p>
      These examples illustrate the variety of uses for xbPositionableElement. Using
      xbPositionableElement you can position an HTML Element in a variety of ways.  
    </p>

    <p>
      Please view source for each example in order to understand it's 
      construction.
    </p>

      <h3>Download</h3>
      <p>
        <a href="examples/xbPositionableElement-examples.zip">xbPositionableElement-examples.zip</a>
      </p>

      <h3>General Examples</h3>

    <h4>
      <a href="examples/tests.html">
        Tests
      </a>
  </h4>
    <p>
      These tests illustrate the behavior of xbPositionableElement using
      each of the possible combinations of horizontal alignment (left, 
    center, right) and vertical alignment (top, center, bottom).
    </p>
      <h5>Support</h5>
      <p>
      Netscape 4.x, Netscape 6.x/7.x, Netscape Gecko Based clients like Compuserve 7, Internet Explorer 5/Windows, 
      Opera 5+
      </p>

    <h4>
      <a href="examples/offset-example.html">
        Offset Example
      </a>
    </h4>
    <p>
        Two positioned images each offset from the bottom corners
        of the window.
    </p>
      <h5>Support</h5>
      <p>
      Netscape 4.x, Netscape 6.x/7.x, Netscape Gecko Based clients like Compuserve 7, Internet Explorer 5/Windows, 
      Opera 5+
      </p>
  
    <h4>
      <a href="examples/animated-offset-example.html">
        Animated Offset Example
      </a>
    </h4>
    <p>
        Two positioned images each offset from the bottom corners
        of the window using animation.
    </p>
      <h5>Support</h5>
      <p>
      Netscape 4.x, Netscape 6.x/7.x, Netscape Gecko Based clients like Compuserve 7, Internet Explorer 5/Windows, 
      Opera 5+
      </p>
  
 </nde:content>

<nde:related area="nde">
  <nde:item url="/toolbox/examples/2002/xb/">More xbAPI Examples</nde:item>
</nde:related>

</nde:article>
