Author Topic: Javascript: Effects and More!  (Read 1086 times)

Offline Primate

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Javascript: Effects and More!
« on: November 30, 2008, 07:28:25 PM »
Lots of sites have neat effects like fading content in and out, accordion menus, and drag-n-drop content. Previously, one would have to use Flash to achieve such affects. However, Flash is an ugly solution: it's slow to load, it doesn't integrate well with the browser, and many people do not have it installed. Using Javascript, you can implement these effects, but the functions for such effects are long and complicated. Javascript libraries, collections of useful functions, were created to solve this problem.

One of my favorite libraries is Prototype. It provides the dollar-sign ($) convenience method for document.getElementById, which greatly speeds up coding. Elements are automatically extended with methods such as addClassName() and hide(), so you don't have to waste time writing cross-browser code. Event handling, which is one of the biggest messes in cross-browser scripting, is taken care of by the Event.observe() function.

Built on top of this library is the fantastic script.aculo.us effects framework, which provides flash-like Javascript effects. All it takes is one line of code to make an element fade in or out. It's also quite customizable: you can change the duration, speed, and other properties of all the effects. It also provides support for dragging and dropping elements. With a bit of AJAX magic (using Prototype's built-in AJAX support), you can easily create dynamic web applications without Flash!

Best of all, both of these frameworks are open source and completely free :smilie:. If you haven't already, take a look and be sure to try them out in your next project!

Helping Webmasters - Webmaster Forum, Website Support and T35 Hosting Support

Javascript: Effects and More!
« on: November 30, 2008, 07:28:25 PM »