backtotop button
This commit is contained in:
@@ -5,7 +5,31 @@ Block.Navigation = new Class({
|
||||
create: function(){
|
||||
var self = this;
|
||||
|
||||
self.el = new Element('ul.navigation');
|
||||
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
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
new ScrollSpy({
|
||||
min: 400,
|
||||
onLeave: function(){
|
||||
self.backtotop.fade('out')
|
||||
},
|
||||
onEnter: function(){
|
||||
self.backtotop.fade('in')
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
addTab: function(tab){
|
||||
@@ -13,7 +37,7 @@ Block.Navigation = new Class({
|
||||
|
||||
return new Element('li').adopt(
|
||||
new Element('a', tab)
|
||||
).inject(self.el)
|
||||
).inject(self.nav)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user