Skip to content

Commit

Permalink
more work on routing to pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Breed committed Dec 26, 2011
1 parent 5e01729 commit 7d2be1e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions app/modules/page.js
Expand Up @@ -11,19 +11,28 @@ module.exports = Backbone.View.extend({
this.bind( 'show', this.onShow, this );
this.bind( 'hide', this.onHide, this );

//Bombers.app.router.route( this.id, this.id, function( id ){
//console.log(id);
//});
},

onShow: function(){
this.el.addClass('ui-active');
Bombers.app.router.navigate( this.route );
this.navigate();
},

onHide: function(){
this.el.removeClass('ui-active');
}
},

show: function(){
var
current = $('.ui-active').index(),
speed = current === this.index ? 600 : 600 * this.index;

$('html,body').stop().animate({ scrollTop: this.el.data('height') }, speed, 'easeInOutQuad' );
},

navigate: function(){
if( $('html,body').is(':animated') === false ){
Bombers.app.router.navigate( this.route, false );
}
}
});

0 comments on commit 7d2be1e

Please sign in to comment.