Por que no lo puedo hechar andar?

medina

x10 Addict
Community Support
Messages
1,811
Reaction score
7
Points
38
Hola, estaba intentando poner este javascript en limpio para ver si funcionoaba y no funciona, tengo problemas, las imagenes son incorrectas solo es para ver si se mueve y asi pero no lo logro hechar andar, si alguien es tan amable de hecharme la mano q sepa javascript se lo agradeceria.

Primero les dejo la pagino donde explica como hacerlo
Ejemplo
Tutorial o explicacion

y lo que tengo es esto para que vean en que no funciona, o mas bien donde esta error.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style>
#fancymenu {
  position: relative;
  height: 29px;
  width: 421px;
  padding: 15px;
  margin: 10px 0;
  overflow: hidden;
}
 
#fancymenu ul {
  padding: 0;
  margin: 0;
}
 
/* Don't apply padding here (offsetWidth will differ in IE)
If you need padding add it to the child anchor */
#fancymenu ul li {
  float: left;
  list-style: none;
}
 
#fancymenu ul li a {
  text-indent: -500em;
  z-index: 10;
  display: block;
  float: left;
  height: 30px;
  position: relative;
  overflow: hidden;
}
#menu_home a {
  width: 59px;
  background: url('tt.jpg') no-repeat center  !important;
  background: url('tt.jpg') no-repeat center; // ie!
}
 
#menu_plantatree a {
  width: 119px;
  background: url('tt.jpg') no-repeat center  !important;
  background: url('tt.jpg') no-repeat center;
}
 
#menu_travel a {
  width: 70px;
  background: url('tt.jpg') no-repeat center  !important;
  background: url('tt.jpg') no-repeat center;
}
 
#menu_rideanelephant a {
  width: 142px;
  background: url('tt.jpg') no-repeat center  !important;
  background: url('tt.jpg') no-repeat center;
}
#fancymenu li.background {
  background: url('tt.jpg') no-repeat top right  !important;
  background: url('tt.jpg') no-repeat top right;
  z-index: 8;
  position: absolute;
  visibility: hidden;
}
 
#fancymenu .background .left {
  background: url('tt.jpg') no-repeat top left  !important;
  background: url('tt.jpg') no-repeat top left;
  height: 30px;
  margin-right: 9px; /* 7px is the width of the rounded shape */
}
</style>
<script language="javascript">
var SlideList = new Class({
	initialize: function(menu, options) {
		this.setOptions(this.getOptions(), options);
 
		this.menu = $(menu), this.current = this.menu.getElement('li.current');
 
		this.menu.getElements('li').each(function(item){
			item.addEvent('mouseover', function(){ this.moveBg(item); }.bind(this));
			item.addEvent('mouseout', function(){ this.moveBg(this.current); }.bind(this));
			item.addEvent('click', function(event){ this.clickItem(event, item); }.bind(this));
		}.bind(this));
 
		this.back = new Element('li').addClass('background').adopt(new Element('div').addClass('left')).injectInside(this.menu);
		this.back.fx = this.back.effects(this.options);
		if(this.current) this.setCurrent(this.current);
	},
 
	setCurrent: function(el, effect){
		this.back.setStyles({left: (el.offsetLeft)+'px', width: (el.offsetWidth)+'px'});
		(effect) ? this.back.effect('opacity').set(0).start(1) : this.back.setOpacity(1);
		this.current = el;
	},
 
	getOptions: function(){
		return {
			transition: Fx.Transitions.sineInOut,
			duration: 500, wait: false,
			onClick: Class.empty
		};
	},
 
	clickItem: function(event, item) {
		if(!this.current) this.setCurrent(item, true);
		this.current = item;
		this.options.onClick(new Event(event), item);
	},
 
	moveBg: function(to) {
		if(!this.current) return;
		this.back.fx.custom({
			left: [this.back.offsetLeft, to.offsetLeft],
			width: [this.back.offsetWidth, to.offsetWidth]
		});
	}
});
 
SlideList.implement(new Options);

window.addEvent('domready', function() {
	new SlideList($E('ul', 'fancymenu'), {transition: Fx.Transitions.backOut, duration: 700, onClick: function(ev, item) { ev.stop(); }});
});
</script>
</head>

<body>
<div id="fancymenu">
  <ul>
    <li class="current" id="menu_home"><a href="#">Home</a></li>
    <li id="menu_plantatree"><a href="#">Plant a tree</a></li>
    <li id="menu_travel"><a href="#">Travel</a></li>
    <li class="background"><div class="left">&nbsp;</div></li>
    <li id="menu_rideanelephant"><a href="#">Ride an elephant</a></li>
    </ul>
</div>
</body>
</html>
 
Top