mirror of
https://github.com/moparisthebest/app-UI
synced 2024-12-21 23:18:52 -05:00
add methods to slide view programmatically (open, close, slideView)
This commit is contained in:
parent
ebdf914795
commit
c8ba613035
@ -162,17 +162,30 @@ SlidingView.prototype.snapToPosition = function() {
|
|||||||
//console.log( currentPosition, halfWidth, targetX );
|
//console.log( currentPosition, halfWidth, targetX );
|
||||||
|
|
||||||
if ( currentPosition != targetX ) {
|
if ( currentPosition != targetX ) {
|
||||||
|
this.slideView(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.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() {
|
SlidingView.prototype.unbindEvents = function() {
|
||||||
this.body.get()[0].removeEventListener( this.MOVE_EVENT, this.touchMoveHandler, false );
|
this.body.get()[0].removeEventListener( this.MOVE_EVENT, this.touchMoveHandler, false );
|
||||||
this.body.get()[0].removeEventListener( this.END_EVENT, this.touchUpHandler, false );
|
this.body.get()[0].removeEventListener( this.END_EVENT, this.touchUpHandler, false );
|
||||||
|
Loading…
Reference in New Issue
Block a user