Home > Articles > Programming > Java

  • Print
  • + Share This

Using the Fade Method

To use the Effects object, we must first import the JavaScript object that we just finished creating. To do so, we type the appropriate path to the object:

<script type="text/javascript" src="path to.../Effects.js"></script>

Once the object is imported, we can simply call its fade method and pass the correct parameters. It’s really that easy:

<img src="images/dscf0298.jpg" id="img1" border="0" onload="Effects.fade(’img1’, 0, 100, 1000, ’Effects.onFaded()’);" />

When the image loads, we simply fire the fade method, passing the ID, the starting and ending opacity percentages, the duration as milliseconds, and (optionally) the callback method. It doesn’t get much easier than that.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.