1
0
mirror of https://github.com/moparisthebest/app-UI synced 2024-12-21 23:18:52 -05:00

Merge pull request #34 from turrea/master

add methods to programmatically slide view
This commit is contained in:
Andrew Trice 2013-02-08 11:03:05 -08:00
commit c1276a4863

View File

@ -162,17 +162,31 @@ 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() {
if(this.bodyOffset == this.sidebarWidth) return;
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 );