$(window).load(function () { "use strict"; var box = $('body'); box.bind('touchstart', touchHandler); box.bind('touchmove', touchHandler); box.bind('touchend', touchHandler); var first = 0; var diff = 0; function touchHandler(e){ //e.preventDefault(); var touch = event.changedTouches[0]; if(e.type === 'touchstart'){ $('#txtaa').text(touch.pageY); first = touch.pageY; } if(e.type === 'touchmove'){ diff = first-touch.pageY; $('#txtaa2').text(diff); if ( diff <= 0 ){ //$('#banner').stop().animate({bottom:0}, 200, 'easeInOutCubic'); $('#banner').stop().animate({bottom:'-190px'}, 100, 'linear'); } else { //$('#banner').stop().animate({bottom: '-50px'}, 200, 'easeInOutCubic'); $('#banner').stop().animate({bottom: 0}, 100, 'linear'); } } if(e.type === 'touchend'){ } } });