Thursday, August 30, 2007

MochiKit - powerfull JavaScript framework



Many of us often have a deal with implementing base functions for JavaScript. At Java we have JDK with a lot of helpfull classes. But at the case of JavaScript developers often have to invent a wheel.
But I found a great framework - MochiKit. It is a set of util classes. I will not tell about all thier capabilities, only which I have used.

1. DIV slide up and slide down.

There is the function:
function slide(elementId){
  var element = document.getElementById(elementId);
  if (element){
    if (element.slideDown){
      MochiKit.Visual.slideDown(element);
      element.slideDown = false;
    }else{
      MochiKit.Visual.slideUp(element);
      element.slideDown = true;
    }
  }
}

1 comment: