DHTML Lab: Cross-Browser Visibility Transitions; The Complete Code 1/2 | WebReference

DHTML Lab: Cross-Browser Visibility Transitions; The Complete Code 1/2


Logo

  Cross-Browser Visibility Transitions
  SPECIAL EDITION; the director's cut 1/2

The HTML Page

Any page that uses the library should have browser-detection, a dummy doTrans() function for non-DHTML browsers and the insertion of the external script:

<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
    NS4 = (document.layers) ? 1 : 0;
    IE4 = (document.all) ? 1 : 0;
   ver4 = (NS4 || IE4) ? 1 : 0;   
  isMac = (navigator.appVersion.indexOf("Mac") != -1) ? 1 : 0;
isTrans = (NS4 || (IE4 && !isMac)) ? 1 : 0;
function doTrans() {return};
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
if (isTrans) {
    document.write("<SCRIPT [keep with next line]
   LANGUAGE='JavaScript1.2' SRC='trans.js'><\/SCRIPT>");
}
//-->
</SCRIPT>
</HEAD>

Using the Transitions

To use a transition, issue the following statement in a script or event handler:

doTrans(elementIDstring,transitionNumber,transitionDuration(secs))

For example, to hide an element called elTrial, using a wipe left transition that lasts four and a half seconds, use this statement:

doTrans("elTrial",7,4.5)

Four of the transitions: 1, 3, 14 and 16 show the element. The remainder hide the element. Therefore, in these four cases, the original state of the element should be hidden. Otherwise, the original state should be visible.

The next page lists the external script.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: Apr. 28, 1998
Revised: Apr. 28, 1998

URL: https://www.webreference.com/dhtml/column19/allCode1.html