Table of Contents
The DHTML Effects files are bundled in a zip file. Click the download link in the Effects section of Zapatec web site, and follow the instructions to download the file. Save the file (zpeffects.zip) to your website root folder on your computer or server.
If you have not done so, follow the instructions to download and extract the Effects files.
In your web editor (Dreamweaver, UltraEdit, etc.), open the web page in which you want to use the effects. Position the cursor before the ending </head> tag. Paste the following script paths before the ending </head> tag:
<!-- Javascript Zapatec utilities file --> <script type="text/javascript" src="utils/zapatec.js"></script> <!-- basic Javascript file for the effects --> <script type="text/javascript" src="zpeffects/src/effects.js"> </script> <!-- Only needed for the slide show--> <script type="text/javascript" src="zpeffects/src/slideshow.js"></script> <!-- Only needed for the hoverer --> <script type="text/javascript" src="zpeffects/src/hoverer.js"></script>
The last two files are optional. Include the slideshow.js file only if you want to create a slide show. Include the hoverer.js file only if you want to enable a user to hover over an item to display an image.
If the web page containing the effects is saved in the zpeffects folder, these lines work without any changes. If, however, you save your web page in another location (for example, directly under your website root folder), you need to adjust the path for these files.
If you have been using a version of Zapatec effects that is older than version 2.0 and are now migrating to the current version, you need to adjust the header files.
The older utils.js is no longer supported; it has been replaced by zapatec.js. To upgrade, replace the old lines:
<script src="utils/utils.js" type="text/javascript"></script> <script src="src/effects.js" type="text/javascript"></script>
with the following:
<script type="text/javascript" src="utils/zapatec.js"></script> <script type="text/javascript" src="zpeffects/src/effects.js"> </script>
All you have to do in your HTML page is to call Zapatec.Effects to have the effect applied to your containers.
See section on how to attach Zapatec Effects to all buttons.
Using your editing or FTP program, copy or move your web page and the entire tree folder to the root of your website.
Using your web browser, navigate to the web page that you created to include the Zapatec DHTML Effects. Congratulations! You have set up the most basic version of the Zapatec DHTML Effects! Now, you can change this highly adaptable application with the help of multiple features provided.
Effects are associated with an element usually with an onclick event.
The onclick calls the Zapatec Effects module.
There are three methods related to Zapatec Effects. They are:
Zapatec.Effects.show - Show the element with effects.
Zapatec.Effects.hide - Hide the element with effects.
Zapatec.Effects.apply - Apply effects to element already displayed. This effect does not have a show/hide effect, hence it is just an apply.
The show and hide functions have the following parameters:
ref (HTMLElement) - This is the DOM element that contains the menu items.
animSpeed (number) - This is animation speed, which ranges from 1 (low speed) to 100 (high speed).
effects (String or array) - This describes the specific effects to apply to the element. It can be a string to apply a single effect or an array of strings to apply multiple effects.
onFinish (function) - This is an optional function to call when the effect ends.
For example, if you want a fade effect for a button, add Zapatec.Effects.show to the onclick event:
<input type=button onclick="Zapatec.Effects.show(this, 5, 'fade')" value='Click for Fade'>
To add several effects to an object, pass an array instead of a single string:
<input type=button onclick="Zapatec.Effects.show(this, 5, ['fade', 'highlight'])" value='Click for Fade'>
An apply is used when a show/hide scenario is not applicable to the particular effect. The effect that is appropriate for apply is dropShadow .
To apply an effect to an element, call Zapatec.Effects.apply(ref, effect, params)
In addition to looking at the examples in this section, a good way to preview the various effects to run the Effects demo.
The effect parameters are lower-case and case-sensitive. For example, the wipe will not work if you pass in ’Wipe’ instead of ’wipe’.
Several effects are sensitive to the browser you use and may require additional customization to work properly.
For example, in Opera and Firefox, Fade and Highlight work regardless of whether CSS position property is set to "absolute".
Though, in Internet Explorer 6.0 and up, Fade requires that the target element be configured with its CSS position property set to "absolute":
<style type="text/css">.styleName{position: absolute}</style> : Highlight, in its turn, works irrespective of the CSS position property value.
Some effects conflict with one another. Consequently, you can not select the combinations of them. In the Custom demo, you may check for possible combinations of effects.
Instead of the container appearing and disappearing instantly, it fades in and out. The opacity dynamically increases on show and decreases on hide.

Instead of the container appearing and disappearing instantly, it slides up from the bottom.
During show, the top of the container appears first and slides up. The container is dynamically clipped from the bottom up. During hide, it slides down.
Instead of the container appearing and disappearing instantly, it slides down from the top.
During show, the top of the container appears first and the container slides down until it is fully displayed. During hide, it slides up from the bottom until it disappears.
The following diagram shows how an element is displayed during show.
Bottom
Middle and Bottom
Top, Middle, and Bottom.

Instead of the container appearing and disappearing instantly, it slides into view from right to left.
During show, the left side of the container appears first and the container slides to the left until it is fully displayed. During hide, it slides to the right until it disappears.
Instead of the container appearing and disappearing instantly, it slides into view from left to right.
During show, the right side of the container appears first and the container slides to the right until it is fully displayed. During hide, it slides to the left until it disappears.
During show, the top of the container appears first and the container glides down until it is fully displayed. During hide, it glides up until it disappears.
For example, on show, the top 10% is displayed, then the next 10%, until 100% is displayed. The container is dynamically clipped from the top down.
Table shows Top, then Top and Middle, then Top, Middle, and Bottom.
Top
Top and Middle
Top, Middle, and Bottom.

During show, the bottom of the container appears first and the container glides up until it is fully displayed. During hide, the container glides down until it disappears.
During show, the left side of the container appears first and the container glides to the right until it is fully displayed. During hide, the container glides to the left until it disappears.
During show, the right side of the container appears first and glides to the left until the container is fully displayed. During hide, the container glides to the right until it disappears.
Instead of the container appearing and disappearing instantly, it wipes in and out. The width and height of the container expand during show and collapse during hide at the same rate. The container (rectangle) is clipped at the top left corner and increases in size until the top left corner reaches the bottom right corner.

With the shrink effect, the presentation of the container shrinks towards the center and continues to shrink until the container is no longer visible.
The Slide Show demo shows how to create a slide show based on containers.
See the Slide Show demo.
You must include slideshow.js in the header file to use this slideshow feature.
Typically, the containers are a set of images and/or DIV elements.
The following options are available to configure a slide show.
If true, then after the last slide was shown it starts from the very beginning.
This is the amount of time, in milliseconds, that each slide will be visible. Each slide can override this value on an individual basis.
This is the amount of time, in milliseconds, for the animation effects.
This is the visual effect for displaying slides. Each slide can have its own effect.
These are the container IDs or references to the HTML elements that provide the content of the slide show.
This is an optional callback to invoke during show and hide.
The callback takes two input arguments:
boolean bshow - true for show, false for hide
int intSlide - the current slide as its position in the slide show
This is an optional callback to invoke when the cycle has finished or is ready to begin. This is useful for displaying an image or message at the end of the cycle.
The callback takes a single input argument:
boolean bEnd - true if at the end of the cycle, false if at the beginning of the cycle
This is the ID of the element to display at the end of the cycle.
While cycling, this display is set to ’none’
At the end of the cycle, this display is set to ’block’
You can use Event Listeners to assign specific actions to certain events. If this event is fired - the appropriate function gets executed. Specify Event Listeners in the constructor. For example:
eventListeners: {
beforeSlideShow: function(slideNumber){
//do something before slide gets shown
},
stop: function(){
//do something after slideshow stops
}
}This event listener is fired before the slide gets hidden. Receives slide ID as parameter.
This event listener is fired after the slide gets hidden. Receives slide ID as parameter.
This event listener is fired before the slide gets shown. Receives slide ID as parameter.
This event listener is fired after the slide gets shown. Receives slide ID as parameter.
This event listener is fired when slideshow is finished. This means that the last slide gets hidden and cycling is turned off.
This event listener is fired after the last slide gets hidden and slide show jumps to the very first slide.
Here is a code example that calls the Zapatec Slide Show constructor:
var slideshow = new Zapatec.SlideShow({
effect: 'fade',
slides: [
"slide1", "slide1a", "slide2", "slide2a", "slide3", "slide3a",
"slide4", "slide4a", "slide5", "slide5a"
],
cycling: true,
animSpeed: 10,
speed: 100,
callback: ss_callback,
eventListeners: {
beforeSlideShow: function(slideNumber){
//do something before slide gets shown
},
stop: function(){
//do something after slideshow stops
}
}
});Then you can use slideshow.start() and slideshow.stop() methods to start and stop slideshow.
The Hoverer demo shows containers dynamically displayed when a user’s mouse hovers over pre-defined anchors.
See the Hoverer demo.
You must include hoverer.js in the header file to use this hoverer feature.
Typically, the anchors are associated with an image or div container.
Here is an example that calls the Zapatec Hoverer constructor:
<script type="text/javascript">
var hoverer = new Zapatec.Hoverer();
hoverer.addElement({anchorRef: 'anchor1', targetRef: 'target1'});
hoverer.addElement({anchorRef: 'anchor2', targetRef: 'target2'});
hoverer.addElement({anchorRef: 'anchor3', targetRef: 'target3'});
</script>
The addElement method adds the anchor and target hoverer associations.
This is the anchor element for the hoverer. It can be any container; it does not have to be an HTML anchor.
The argument is either the ID of the container as a string or the container object.
This is the element that is displayed when the user’s mouser hovers over the anchor. The argument is either the ID of the target element as a string, or the object.
The following example shows how to apply effects globally to all the buttons on the page.
<html>
<head>
<script type='text/javascript' src='../utils/utils.js'></script>
<script type="text/javascript" src="../src/effects.js"></script>
<script>
function attach_effects() {
var e, i;
e=document.getElementsByTagName('input')
// All buttons
for (i=0; i<e.length; i++)
if (e[i].type=='button')
e[i].onclick=function() { Zapatec.Effects.show(this, 5, ['highlight']) }
}
</script>
</head>
<body onload='attach_effects()'>
Only BUTTON types will have effects<br>
<form action=''>
<input type=button value="Button 1">
<input type=button value="Button 2">
<input type=button value="Button 3">
<br>Input Text<input type=text><br>
<input type=submit>
</form>
</body>
</html>