diff --git a/masks/project.html b/masks/project.html index 0bbbca1..ab1629a 100755 --- a/masks/project.html +++ b/masks/project.html @@ -103,6 +103,11 @@ function initPage(asHash) { //Add "Loading" Post 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 initProject(asHash.items[0]); } diff --git a/script/spot.js b/script/spot.js index 02f6ab2..0a57320 100755 --- a/script/spot.js +++ b/script/spot.js @@ -295,3 +295,18 @@ $.prototype.hoverSwap = function(sDefault, sHover) }) .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}); + }); +};