How can I make my jquery draggable / droppable code faster?

后端 未结 3 520
借酒劲吻你
借酒劲吻你 2020-12-05 11:47

I\'ve used JQuery to make the elements in a table draggable. (I\'ve never used JQuery before this). It works fine, but is very slow. For example, from the moment I

3条回答
  •  温柔的废话
    2020-12-05 12:29

    The presence of so many drop targets seems to make the performance so slow. If possible, try setting the table as a single drop target and calculate the target table cell based on the position data in the drop event.

    Unfortunately, you will also lose the ability to apply styles to individual cells on dragOver and dragOut events.

    Edit: Another suggestion is to disable droppable on all tds and upon mouseover of a tr, enable the droppables of tds present in the specific tr (and disable them back upon mouseout of tr). Sounds like a hack, but worth a try.

提交回复
热议问题