久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何檢查 IE Drag &放棄對(duì)任何元素的支持

How to check for IE Drag amp; Drop support of any element(如何檢查 IE Drag amp;放棄對(duì)任何元素的支持)
本文介紹了如何檢查 IE Drag &放棄對(duì)任何元素的支持的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號(hào)..

有沒有辦法檢查用戶代理是否支持拖動(dòng)&刪除特定元素(div、tr、...)?

Is there a way to check if a user agent supports drag & drop of a particular element (div, tr,...)?

我有一個(gè)帶有可拖動(dòng)表格行的表格,它在 Chrome 中運(yùn)行良好.但是由于 Internet Explorer(最高版本 9)只支持圖像和鏈接(以及其他一些)的拖動(dòng),我想在表格行內(nèi)給它一個(gè)小的錨點(diǎn)拖動(dòng)句柄.我的代碼如下所示:

I've got a table with draggable table rows, which works fine in Chrome. But since Internet Explorer (up to version 9) only supports dragging of images and links (and a few others), I wanted to give it a little anchor drag handle inside the table row instead. My code looks something like this:

<table>
    <tr draggable="true">
        <td><a class="drag-handle"></a> Hello World</td>
    </tr>
</table>

JS/jQuery:

$('tr[draggable]').each(function() {
    // Remove draggable="true" from <tr>
    $(this).attr('draggable', '');
    // Add draggable="true" to <a class="drag-handle">
    $(this).find('.drag-handle').attr('draggable', 'true');
});

顯然,要真正完成這項(xiàng)工作還有很多工作要做,但要點(diǎn)是:如果用戶的客戶端不支持拖動(dòng) a (IE<10),則給用戶一個(gè)拖動(dòng)的東西.

Obviously, there is a lot more to do to actually make this work, but you get the gist: giving the user a drag thingy if their client doesn't support dragging of a (IE<10).

現(xiàn)在我只想在用戶的客戶端不支持拖動(dòng)表格行的情況下進(jìn)行替換.是否有任何已知的特征檢測?

Now i want to do the replacement only if the user's client doesn't support dragging of table rows. Is there any known feature detection for that?

推薦答案

來自 檢測 javascript 中的 HTML5 拖放支持:

if('draggable' in document.createElement('span')) {
    alert("Drag support detected");
}

感謝 Mark Rhodes 的提示!還要感謝 micha 指出我的 jQuery 錯(cuò)誤 (removeAttr('draggable') 而不是attr('draggable')).

Thanks to Mark Rhodes for the tip! Also thanks to micha for pointing out my jQuery error (removeAttr('draggable') instead of attr('draggable')).

這篇關(guān)于如何檢查 IE Drag &amp;放棄對(duì)任何元素的支持的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How do I write FileReader test in Jasmine?(如何在 Jasmine 中編寫 FileReader 測試?)
JS/HTML5 WebSocket: Connect without HTTP call(JS/HTML5 WebSocket:無需 HTTP 調(diào)用即可連接)
CSS: Repeat Table Header after Page Break (Print View)(CSS:分頁后重復(fù)表頭(打印視圖))
Put HTML head in another file(將 HTML 頭放在另一個(gè)文件中)
What is the real difference between the quot;headquot; and quot;headerquot; tag?(“頭和“頭之間的真正區(qū)別是什么?和“標(biāo)題標(biāo)簽?)
Header/Footer Layout with 100% Content Height in IE8(IE8 中具有 100% 內(nèi)容高度的頁眉/頁腳布局)
主站蜘蛛池模板: 97伊人| 国产成人综合在线 | 午夜精品网站 | 亚洲毛片 | 97人人澡人人爽91综合色 | 色综合久久天天综合网 | 午夜激情免费 | 成人1区2区| 夜夜爽99久久国产综合精品女不卡 | 精品国产青草久久久久96 | 一区二区三区日韩 | 欧美精品福利视频 | 亚洲视频一区二区三区 | 最新国产精品 | 91美女在线 | 不卡一二区 | 久久综合一区 | 亚洲一区二区视频在线观看 | 色婷婷综合久久久中字幕精品久久 | 91久久国产综合久久 | 一级特黄色毛片 | 日韩一区在线视频 | 亚洲精品久久久久久下一站 | 国产精品亚洲综合 | 亚洲视频一区二区三区 | 羞羞视频免费在线观看 | 一区二区免费 | 成年人黄色小视频 | 午夜午夜精品一区二区三区文 | av成人在线观看 | 欧美激情久久久久久 | 欧美黄色性生活视频 | 精品成人在线视频 | 欧美日韩久久精品 | 一区二区三区视频 | 四色成人av永久网址 | 亚洲一区二区免费视频 | 日韩免费一区二区 | 日韩精品一二三区 | 黄色毛片在线观看 | 国产精品毛片一区二区在线看 |