Ik probeer een aantal Jquery functionaliteiten te combineren (hide, accordion en drag/drop). Voor 80% werkt dat. De accordion werkt, het hiden van het menu werkt maar drag/drop werkt niet. Het lijkt erop dat ik mijn draggable object niet buiten de menu div kan draggen.
Dit is mijn code
Ik wil dus een toolboxitem slepen naar de activityzone maar het draggen stopt (lijkt het) bij de rand van de div "panel"
Dit is mijn code
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Collapsible Panel</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="reset.css"/> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="general.js"></script> <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script> <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.draggable.js"></script> <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.droppable.js"></script> <script type="text/javascript" src="http://ui.jquery.com/latest/ui/effects.core.js"></script> <script type="text/javascript"> <!--//---------------------------------+ // Developed by Roshan Bhattarai // Visit http://roshanbh.com.np for this script and more. // This notice MUST stay intact for legal use // ---------------------------------> $(document).ready(function() { //slides the element with class "menu_body" when paragraph with class "menu_head" is clicked $("#firstpane p.menu_head").click(function() { $(this).css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow"); $(this).siblings().css({backgroundImage:"url(left.png)"}); }); //slides the element with class "menu_body" when mouse is over the paragraph $("#secondpane p.menu_head").mouseover(function() { $(this).css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideDown(500).siblings("div.menu_body").slideUp("slow"); $(this).siblings().css({backgroundImage:"url(left.png)"}); }); /////////////////// // Drag N Drop //////////////////// $(".ToolboxItem").draggable({ 'opacity': 0.3, 'revert': "valid", 'delay': 200, 'distance':4, 'helper':"clone" }); $(".ActivityZone").droppable({ 'accept':".ToolboxItem", 'activeClass':"border", 'drop': function(e,ui){alert("test"); } }); }); </script> <style type="text/css"> .ToolboxItem {border:#000000 solid 2px;} .ActivityZone { position: relative; border:#000000 solid 2px; padding:6px; min-height:200px; width:570px; } body { margin: 10px auto; font: 75%/120% Verdana,Arial, Helvetica, sans-serif; } .menu_list { width: 150px; } .menu_head { padding: 5px 10px; cursor: pointer; position: relative; margin:1px; font-weight:bold; background: #eef4d3 url(left.png) center right no-repeat; } .menu_body { display:none; } .menu_body a{ display:block; color:#006699; background-color:#EFEFEF; padding-left:10px; font-weight:bold; text-decoration:none; } .menu_body a:hover{ color: #000000; text-decoration:underline; } .temp{ background: #EFEFEF; } </style> </head> <body> <div id="colleft"> <div id="panel"> <div id="firstpane" class="menu_list"> <!--Code for menu starts here--> <p class="menu_head">Header-1</p> <div class="menu_body"> <DIV class="temp"><IMG class=ToolboxItem src="images/Conditional.png" width="30" height="30"><BR>Set a condition</DIV> <DIV class="temp"><IMG class=ToolboxItem src="images/Conditional.png" width="30" height="30"><BR>Request approval</DIV> <DIV class="temp"><IMG class=ToolboxItem src="images/Email.gif" width="30" height="30"><BR>Send a notification</DIV> </div> <p class="menu_head">Header-2</p> <div class="menu_body"> <a href="#">Link-1</a> <a href="#">Link-2</a> <a href="#">Link-3</a> </div> <p class="menu_head">Header-3</p> <div class="menu_body"> <a href="#">Link-1</a> <a href="#">Link-2</a> <a href="#">Link-3</a> </div> </div> <!--Code for menu ends here--> <div id="hidePanel"><a href="#">« Hide Panel</a></div> </div> </div> <div id="showPanel"><span>»</span></div> <div id="colright" class="ActivityZone"> <div> <img src="images/StartWorkflow.png" alt="Start workflow" style="border-width:0px;" width="63" height="27"></div> </div> </body> </html> |
Ik wil dus een toolboxitem slepen naar de activityzone maar het draggen stopt (lijkt het) bij de rand van de div "panel"