問(wèn)題描述
我正在編寫(xiě)一個(gè)新的 Web 應(yīng)用程序,它需要支持頁(yè)面上元素的拖放操作(不是文件拖放).
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).
這就是這個(gè)問(wèn)題的答案
html5 vs jquery拖放
建議使用 Modernizr 來(lái)檢查瀏覽器是否支持 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.
由于它們具有完全不同的模型,這意味著所有拖放代碼都必須單獨(dú)實(shí)現(xiàn)和測(cè)試(很少有共享實(shí)現(xiàn)).如果 HTML5 拖放對(duì)用戶(hù)有顯著的影響,并且回退到 jQuery UI 會(huì)提供降級(jí)的體驗(yàn),那么這樣做似乎是合乎邏輯的.
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.
實(shí)現(xiàn)這兩種變體是否有顯著的好處?
Are there significant benefits to implementing both variants?
推薦答案
我猜 jQuery 最終會(huì)利用內(nèi)置的瀏覽器功能,比如 html 5 拖放.
I would guess that eventually jQuery will take advantage of built-in browser capabilities like html 5 drag and drop.
如果不同的瀏覽器以不同的方式實(shí)現(xiàn)它......jQuery會(huì)處理它.
And if different browsers implement it differently...jQuery will deal with it.
這篇關(guān)于HTML 5 拖放相對(duì)于 jQuery UI 拖放的優(yōu)勢(shì)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!