You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
878 B

Block.Navigation = new Class({
Extends: BlockBase,
create: function(){
var self = this;
13 years ago
self.el = new Element('div.navigation').adopt(
self.nav = new Element('ul'),
self.backtotop = new Element('a.backtotop', {
'text': 'back to top',
'events': {
'click': function(){
window.scroll(0,0)
}
},
'tween': {
'duration': 100
}
})
)
13 years ago
new ScrollSpy({
min: 400,
onLeave: function(){
self.backtotop.fade('out')
},
onEnter: function(){
self.backtotop.fade('in')
}
})
},
addTab: function(name, tab){
var self = this
return new Element('li.tab_'+(name || 'unknown')).adopt(
new Element('a', tab)
13 years ago
).inject(self.nav)
},
activate: function(name){
var self = this;
self.nav.getElements('.active').removeClass('active');
self.nav.getElements('.tab_'+name).addClass('active');
}
});