Ticket #6009: dnd_ticket.html

File dnd_ticket.html, 2.7 KB (added by maxbarbul, 7 years ago)

incorrect drop when second created droppable has greater z-index then first and it hovers first one

Line 
1<!DOCTYPE html>
2<html lang="en">
3<head>
4    <meta charset="UTF-8" />
5    <title>jQuery UI Droppable - Accept Demo</title>
6    <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/base/jquery-ui.css" rel="stylesheet" />
7    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
8    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/jquery-ui.min.js"></script>
9    <link type="text/css" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" rel="stylesheet" />
10    <style type="text/css">
11    #droppable1,#droppable2 {
12        position: absolute;
13        width: 150px;
14        height: 150px;
15        padding: 0.5em;
16        float: left;
17        margin: 10px;
18    }
19    #droppable1 {
20        z-index: 20;
21        top: 100px;
22        left: 100px;
23    }
24    #droppable2 {
25        z-index: 22;
26        top: 130px;
27        left: 130px;
28    }
29
30    #draggable {
31        z-index: 25;
32        width: 100px;
33        height: 100px;
34        padding: 0.5em;
35        float: left;
36        margin: 10px 10px 10px 0;
37    }
38    </style>
39    <script type="text/javascript">
40    $(function() {
41        $("#draggable").draggable()
42
43        $("#droppable1").droppable({
44            accept: '#draggable',
45            activeClass: 'ui-state-hover',
46            hoverClass: 'ui-state-active',
47            drop: function(event, ui)
48            {
49                $(this).addClass('ui-state-highlight').find('p').html('Dropped!')
50            }
51        })
52
53        $("#droppable2").droppable({
54            accept: '#draggable',
55            activeClass: 'ui-state-hover',
56            hoverClass: 'ui-state-active',
57            drop: function(event, ui)
58            {
59                $(this).addClass('ui-state-highlight').find('p').html('Dropped!')
60            }
61        })
62    })
63    </script>
64
65</head>
66<body>
67<div class="demo">
68
69<div id="draggable" class="ui-widget-content">
70    <p>Drag me to my target</p>
71</div>
72
73<div id="droppable1" class="ui-widget-header">
74    <p>accept: '#draggable'</p>
75</div>
76<div id="droppable2" class="ui-widget-header">
77    <p>accept: '#draggable'</p>
78</div>
79</div><!-- End demo -->
80<ol>
81<li>
82    Try to drag draggable over two droppables.
83    There are positions when they both are hovered though only one should be.
84    I think that only one droppable should be hovered because only one could receive this draggable so only one should show that it's waiting.
85</li>
86<li>
87    When you drop draggable into intersection of droppable1 and droppable2 (when they are hovered) only droppable1 will receive draggable though droppable2 is on top.
88    And droppable2 will be keeping hoverClass untill next dragging.
89</li>
90</ol>
91</body>
92</html>