拖动对象时,用户可以在 x 和 y 轴上拖动。我想将可拖动性限制为仅 x 轴。我该怎么做呢?
谢谢!
查看轴选项:
“限制拖动到水平 (x) 或垂直 (y) 轴。可能的值:'x'、'y'。”
例子:
// Initialize a draggable with the axis option specified.
$( ".selector" ).draggable({ axis: 'x' });
// Get the axis option, after initialization.
var axis = $('.selector').draggable('option', 'axis');
// Set the axis option, after initialization.
$('.selector').draggable('option', 'axis', 'x');