Internet Explorer 9 przeciągnij i upuść (DnD)

Czy ktoś wie, dlaczego poniższe przykłady przeciągnij i upuść (plus wiele innych samouczków online) nie działają w Internet Explorer 9? Chrome, FireFox i Safari są w porządku.

Http://www.html5rocks.com/tutorials/dnd/basics/

Myślałem, że IE9 ma być najbardziej zgodną z HTML5 przeglądarką? Zwłaszcza z DnD, ponieważ wspierają go od IE5. Czy muszę gdzieś zmieniać ustawienia?

Im więcej gram z HTML5 i CSS3...im więcej Brak IE9.

Czy ktoś ma jakieś linki do tutoriali DnD, które działają w IE9?

Author: j0k, 2011-03-31

9 answers

Cóż spotkałem się z tym samym dziwnym zachowaniem w IE9, wydaje się, że IE9 nie będzie przeciągać i upuszczać (styl HTML 5) na div. jeśli zmienisz div Na A Z href= " # " będziesz mógł przeciągać i upuszczać.

To nie będzie ciągnąć:

<div data-value="1" class="loadedmodule-container" draggable="true">drag</div>

A to będzie:

<a href="#" data-value="1" class="loadedmodule-container" draggable="true">drag</a>
Mam nadzieję, że to komuś pomoże]}
 21
Author: Didier Caron,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-06-18 12:34:40

Znalazłem sposób na to, aby natywne API dnd działało również w IE z elementami innymi niż linki i obrazki. Dodaj obsługę onmousemove do przeciąganego kontenera i wywołaj natywny element funkcji IE.dragDrop(), po naciśnięciu przycisku:

function handleDragMouseMove(e) {
    var target = e.target;
    if (window.event.button === 1) {
        target.dragDrop();
    }
}

var container = document.getElementById('widget');
if (container.dragDrop) {
    $(container).bind('mousemove', handleDragMouseMove);
}

// todo: add dragstart, dragover,... event handlers
 25
Author: terabaud,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-01-24 11:40:48

Napotkałem ten sam problem. Ta sztuczka działa na mnie:

node.addEventListener('selectstart', function(evt) {
    this.dragDrop();
    return false;
}, false);

Zatrzymuje zaznaczenie i rozpoczyna przeciąganie.

 3
Author: Ali Gangji,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-04-07 21:19:38

Ten przykład DnD działa w IE9.

Myślę, że przykład z HTML5Rocks nie działa w IE9 z powodu funkcji CSS3. W przykładzie użyto kilku funkcji CSS3, ale obsługa IE9 CSS3 nie jest dobra.

Ponadto niektóre zdarzenia i metody JS nie działają w IE. Na przykład setDragImage() nie działa nawet w IE9. Jest to również jeden z powodów.

 2
Author: Sanghyun Lee,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-06-01 14:50:08

I 've been looking atribute too, I' ve found that Opera 11.50 has the same basic issue; both it and IE9 do not understand the HTML5 draggable attribute, or the HTML5 drag-and-drop events.

Jako obejście, znalazłem ten artykuł Opery na http://dev.opera.com/articles/view/accessible-drag-and-drop / emuluje obsługę przeciągania i upuszczania za pomocą zdarzeń mousedown, mouseover, mousemove, mouseout i mouseup. Oczywiście jest to dużo pracy, ale daje wsparcie dnd w Opera.

Możesz zobaczyć demo na http://devfiles.myopera.com/articles/735/example.html

Ten sam trik emulacyjny dnd działa z IE9 i wydaje się kompatybilny z innymi przeglądarkami HTML5.

 1
Author: adamrmcd,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-07-17 18:39:29

Mam ten sam problem co wyżej Didier Caron. Przeciągalne div s nie działają, ale znaczniki anchor działają dobrze. Znalazłem rozwiązanie w HTML5 Doctor .

 0
Author: jaysmith024,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-12-05 22:35:02

Sugerowałbym użycie jQuery UI ' s draggable .

 0
Author: AlexC,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-12-05 22:43:13

Używa elementu, który domyślnie ma właściwość draggable ustawioną na true. oni i powinno zadziałać Cheers

 0
Author: Hubert Boma Manilla,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-04-12 10:09:31

To mi pasuje. To sprawia, że IE9 zachowuje się jak inne nowoczesne przeglądarki, jeśli chodzi o drag/drop:

if (document.doctype && navigator.appVersion.indexOf("MSIE 9") > -1) {
    document.addEventListener('selectstart', function (e) {
        for (var el = e.target; el; el = el.parentNode) {
            if (el.attributes && el.attributes['draggable']) {
                e.preventDefault();
                e.stopImmediatePropagation();
                el.dragDrop();
                return false;
            }
        }
    });
}
 0
Author: Bernardo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-05-11 20:51:32