javascript - jQuery draggable with touch punch - flickering issue -
my draggable div becomes draggable on touch devices, "flickers" weird positions when starting move it. works charm om desktop devices not on ipad or android.
any suggestions solution?
thanks in advance!
unfortunately, can't share code since go product, , not able reproduce issue in jsfiddle or similar.
but have made fix draggable flickering on touch devices, share here if else encounters problem.
var prevpos = null, diffx, diffy, maxdiff; $( '#draggable' ).draggable( { ..., ..., drag: function ( event, ui ) { if ( prevpos ) { diffx = math.abs( prevpos.left - ui.position.left ); diffy = math.abs( prevpos.top - ui.position.top ); maxdiff = math.max( diffx, diffy ); if ( maxdiff > 60 ) { ui.position = prevpos; } } prevpos = ui.position; }, stop: function ( event, ui ) { prevpos = null; } } );
Comments
Post a Comment