Crash1hd
04-20-2003, 07:07 AM
I was given a code by someone that does what I was looking for earlier! Yet all I was given was the js file so I was wondering if someone wouldnt mind taking a couple of minutes to decifer the following code for me exspecially the "init : function" and how that works as all functions I use are function init() so what programming or codeing is the stuff in red!
var MenuEvents = {
init : function() {
var t = document.getElementById("menu");
var handle = t.getElementsByTagName("H2").item(0);
MenuEvents.isOut = false;
handle.onclick = MenuEvents.clicked;
},
clicked : function(e) {
if(this.anim)
this.anim.cancelSlide();
if(!MenuEvents.isOut) {
this.anim = new Animation.obj( document.getElementById("menu") );
this.anim.slideTo(null, 30, 300);
MenuEvents.isOut = true;
} else {
this.anim = new Animation.obj( document.getElementById("menu") );
this.anim.slideTo(null, -270, 300);
MenuEvents.isOut = false;
}
}
}
the rest of the js file is attached! as a txt file
var MenuEvents = {
init : function() {
var t = document.getElementById("menu");
var handle = t.getElementsByTagName("H2").item(0);
MenuEvents.isOut = false;
handle.onclick = MenuEvents.clicked;
},
clicked : function(e) {
if(this.anim)
this.anim.cancelSlide();
if(!MenuEvents.isOut) {
this.anim = new Animation.obj( document.getElementById("menu") );
this.anim.slideTo(null, 30, 300);
MenuEvents.isOut = true;
} else {
this.anim = new Animation.obj( document.getElementById("menu") );
this.anim.slideTo(null, -270, 300);
MenuEvents.isOut = false;
}
}
}
the rest of the js file is attached! as a txt file