Smoother drag on element

This commit is contained in:
Kasper Rynning-Tønnesen
2017-06-19 07:21:31 +02:00
parent 9a721102c0
commit bd950fc1e7
3 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -30,20 +30,20 @@ var List = {
jqDraggableItem.off("touchend", Helper.touchend); jqDraggableItem.off("touchend", Helper.touchend);
$( ".list-song" ).draggable({ $( ".list-song" ).draggable({
axis:"x", axis:"x",
containment: [-50, 0, 10, 0], containment: [-60, 0, 10, 0],
scroll: true, scroll: true,
drag: function(event, ui) { drag: function(event, ui) {
if(Helper.vertScroll) { if(Helper.vertScroll) {
return false; return false;
} }
if(ui.offset.left <= -10) { if(ui.offset.left <= -10) {
ui.position.left = ui.offset.left - 10; ui.position.left = ui.offset.left;
} else { } else {
ui.position.left = 0; ui.position.left = 0;
} }
}, },
stop: function(event, ui) { stop: function(event, ui) {
if(ui.offset.left == -50) { if(ui.offset.left == -50 && !Helper.vertScroll) {
try { try {
navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
if (navigator.vibrate) { if (navigator.vibrate) {