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