如何防止div元素上的draggable?

问题描述:

在我的程序中,div(此处称为'my_div'元素可拖动:

In my program, a div (called 'my_div' here element is draggable:

$("#my_div").draggable();



在这个div中,有带有垂直滚动条的表格。当我点击表格的滚动条时,整个'my_div'变得可拖动。如何禁用桌面上的daggable?我尝试了下面这段代码,但它不起作用(见以下错误消息:


In this div, there is a table w/ a vertical scrollbar. When I click on the scrollbar of the table, the whole 'my_div' becomes draggable. How can I disable the daggable on the table? I tried this piece of code below but it does not work (see the error message below:

<div id='tbl_RecList' class='styleTable3' >
</div>
...
function preventDraggable(e) {
   e.preventDefault();    // error: Object doesn't support property or method 'preventDefault'
}



应该使用什么代码在里面 function preventDraggable()?谢谢,如果你能提供帮助的话。



我尝试过:



试过preventDefault()但没有成功


What code should be used in the function preventDraggable()? Thanks if you can help.

What I have tried:

Tried preventDefault() but not successful

。#my_div跨度>)拖动();
("#my_div").draggable();



在这个div中,有一个带有垂直滚动条的表格。当我点击表格的滚动条时,整个'my_div'变为可拖动。如何禁用桌面上的daggable?我在下面尝试了这段代码,但它不起作用(请参阅下面的错误消息:


In this div, there is a table w/ a vertical scrollbar. When I click on the scrollbar of the table, the whole 'my_div' becomes draggable. How can I disable the daggable on the table? I tried this piece of code below but it does not work (see the error message below:

<div id='tbl_RecList' class='styleTable3' >
</div>
...
function preventDraggable(e) {
   e.preventDefault();    // error: Object doesn't support property or method 'preventDefault'
}



函数preventDraggable()中应该使用哪些代码?如果你能提供帮助,谢谢。



我试过的:



尝试过preventDefault()但没有成功


What code should be used in the function preventDraggable()? Thanks if you can help.

What I have tried:

Tried preventDefault() but not successful






我不确定,我的代码是否适合您,但是请您使用以下代码尝试一次:



Hi,

I am not sure, whether my piece of code will work for you or not, but can you please try once with the below code :


(#my_div)。不是(#table_id)。draggable();
("#my_div").not("#table_id").draggable();





如果这不适合你,请告诉我。我可以想到其他一些解决方案。



Please let me know if this won't work for you. I can think of some other solution.