add swipe event catcher
This commit is contained in:
@@ -103,6 +103,11 @@ function initPage(asHash) {
|
|||||||
//Add "Loading" Post
|
//Add "Loading" Post
|
||||||
getPost({type: 'loading', headerless: true, formatted_time: '', relative_time: ''}).appendTo($('#loading'));
|
getPost({type: 'loading', headerless: true, formatted_time: '', relative_time: ''}).appendTo($('#loading'));
|
||||||
|
|
||||||
|
//Mobile events
|
||||||
|
$("#feed").onSwipe(function(aiDelta){
|
||||||
|
if(aiDelta.x > self.tmp('feed_width')/3 && aiDelta.x > Math.abs(aiDelta.y)) toggleFeedPanel(false);
|
||||||
|
});
|
||||||
|
|
||||||
//project Bootstrap
|
//project Bootstrap
|
||||||
initProject(asHash.items[0]);
|
initProject(asHash.items[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,3 +295,18 @@ $.prototype.hoverSwap = function(sDefault, sHover)
|
|||||||
})
|
})
|
||||||
.text(sDefault);
|
.text(sDefault);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.prototype.onSwipe = function(fCallBack){
|
||||||
|
return $(this)
|
||||||
|
.on('mousedown touchstart', function(e) {
|
||||||
|
var $This = $(this);
|
||||||
|
$This.data('x-down', e.pageX);
|
||||||
|
$This.data('y-down', e.pageY);
|
||||||
|
})
|
||||||
|
.on('mouseup touchend',function (e) {
|
||||||
|
var $This = $(this);
|
||||||
|
var iDeltaX = e.pageX - $This.data('x-down');
|
||||||
|
var iDeltaY = e.pageY - $This.data('y-down');
|
||||||
|
fCallBack({x:iDeltaX, y:iDeltaY});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user