add methods to slide view programmatically (open, close, slideView)

This commit is contained in:
Tommy Urrea 2012-12-20 03:48:33 -08:00
parent ebdf914795
commit c8ba613035
1 changed files with 21 additions and 8 deletions

View File

@ -162,17 +162,30 @@ SlidingView.prototype.snapToPosition = function() {
//console.log( currentPosition, halfWidth, targetX );
if ( currentPosition != targetX ) {
this.body.stop(true, false).animate({
left:targetX,
avoidTransforms:false,
useTranslate3d: true
}, 100);
this.sidebar.trigger( "slidingViewProgress", { current:targetX, max:this.sidebarWidth } );
this.slideView(targetX);
}
}
SlidingView.prototype.slideView = function(targetX) {
this.body.stop(true, false).animate({
left:targetX,
avoidTransforms:false,
useTranslate3d: true
}, 100);
this.sidebar.trigger( "slidingViewProgress", { current:targetX, max:this.sidebarWidth } );
}
SlidingView.prototype.close = function() {
this.bodyOffset = 0;
this.slideView(0);
}
SlidingView.prototype.open = function() {
this.bodyOffset = this.sidebarWidth;
this.slideView(this.sidebarWidth);
}
SlidingView.prototype.unbindEvents = function() {
this.body.get()[0].removeEventListener( this.MOVE_EVENT, this.touchMoveHandler, false );
this.body.get()[0].removeEventListener( this.END_EVENT, this.touchUpHandler, false );