我正在尝试使用jsPlumb将问题与测验中的答案联系起来。我有大部分工作期望我希望能够单击一个问题,然后单击一个答案,而不是从一个端点拖动到另一个端点。这是因为在触摸设备上拖动很乏味。这可能吗?
这是我正在使用的 jquery。
$(document).ready(function () {
var targetOption = {
anchor: "LeftMiddle",
isSource: false,
isTarget: true,
reattach: true,
endpoint: "Rectangle",
connector: "Straight",
connectorStyle: { strokeStyle: "#ccc", lineWidth: 5 },
paintStyle: { width: 20, height: 20, fillStyle: "#ccc" },
setDragAllowedWhenFull: true
}
var sourceOption = {
tolerance: "touch",
anchor: "RightMiddle",
maxConnections: 1,
isSource: true,
isTarget: false,
reattach: true,
endpoint: "Rectangle",
connector: "Straight",
connectorStyle: { strokeStyle: "#ccc", lineWidth: 5 },
paintStyle: { width: 20, height: 20, fillStyle: "#ccc" },
setDragAllowedWhenFull: true
}
jsPlumb.importDefaults({
ConnectionsDetachable: true,
ReattachConnections: true
});
jsPlumb.addEndpoint('match1', sourceOption);
jsPlumb.addEndpoint('match2', sourceOption);
jsPlumb.addEndpoint('match3', sourceOption);
jsPlumb.addEndpoint('match4', sourceOption);
jsPlumb.addEndpoint('answer1', targetOption);
jsPlumb.addEndpoint('answer2', targetOption);
jsPlumb.addEndpoint('answer3', targetOption);
jsPlumb.addEndpoint('answer4', targetOption);
jsPlumb.draggable('match1');
jsPlumb.draggable('answer1');
});