HTML 5 拖放相对于 jQuery UI 拖放的优势

2022-01-11 00:00:00 drag-and-drop html jquery-ui-draggable

我正在编写一个新的 Web 应用程序,它需要支持页面上元素的拖放操作(不是文件拖放).

I'm writing a new web application that needs to support drag and drop operations for elements on the page (not file drag and drop).

这就是这个问题的答案

html5 vs jquery拖放

建议使用 Modernizr 来检查浏览器是否支持 HTML5 拖放,并使用该支持或回退到 jQuery UI 等替代方案.

recommends using Modernizr to check whether the browser supports HTML5 drag and drop and either use that support or fall back to an alternative like jQuery UI.

由于它们具有完全不同的模型,这意味着所有拖放代码都必须单独实现和测试(很少有共享实现).如果 HTML5 拖放对用户有显着的影响,并且回退到 jQuery UI 会提供降级的体验,那么这样做似乎是合乎逻辑的.

Since they have quite different models, that means that all drag and drop code would have to be implemented and tested separately (very little shared implementation). It only seems logical to do that if there are significant, user-impacting benefits to HTML5 drag and drop and if the fallback to jQuery UI would provide a degraded experience.

实现这两种变体是否有显着的好处?

Are there significant benefits to implementing both variants?

推荐答案

我猜 jQuery 最终会利用内置的浏览器功能,比如 html 5 拖放.

I would guess that eventually jQuery will take advantage of built-in browser capabilities like html 5 drag and drop.

如果不同的浏览器以不同的方式实现它......jQuery会处理它.

And if different browsers implement it differently...jQuery will deal with it.

相关文章