Can We Make JQuery UI Draggables / Sortables To Work On Right Mouse Button

后端 未结 4 1172
再見小時候
再見小時候 2021-02-20 11:27

I have a page that has functions bind to both left and right mouse button, ie. draggable/sortable on left mouse button, and custom context menu on right mouse button.

Wh

4条回答
  •  佛祖请我去吃肉
    2021-02-20 12:13

    Try this:

    $('#element').mousedown(function(event) {
        if(event.which == 1) {
            $('#element').draggable();
            $('#element').sortable();
        } else if (event.which == 3) {
            // context menu functions
        }
    });
    

提交回复
热议问题