On Jun 22, 12:27 pm, "Gary Hussey" <
seventha...@gmail.com> wrote:
> that's cute. I've never seen that before. the sitesays it's using the most
> recent version of mootools.
>
The most recent version though, was for Mootool1.1.
Here is the base code that I am trying to port over to MooTools1.2.
Things like $E are no longer used in 1.2
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('mouseout', function(){ this.moveBg.delay(1,
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) {
this.timer = $clear(this.timer);
if(!this.current) return;
this.back.fx.custom({
left: [this.back.offsetLeft, to.offsetLeft],
width: [this.back.offsetWidth, to.offsetWidth]
});
}
});
SlideList.implement(new Options);
// afects floater back
window.addEvent('domready', function() {
// Navbar
if($('menubar'))
FancyExample = new SlideList($E('ul', 'menubar'), {transition:
Fx.Transitions.backOut, duration: 1000, onClick: function(ev, item)
{ }});
});