sj_tt6
22 Jul 2010, 1:39 PM
Hi,
My page has several draggable images and a drop item. My purpose is to drag images to the drop item. My page works fine. However if I put the images under 1 or 2 other div then it stops working. The snippet is below.
<div class='class1'>
<div id='someid' class="class2">
<div id="invalid" style="display:none">Don't drag me!</div>
<img class="image" id='img_1' src='images/img1.jpg' border="0"/>
<img class="image" id='img_2' src='images/img2.jpg' border="0"/>
<img class="image" id='img_3' src='images/img3jpg' border="0"/>
<img class="image" id='img_4' src='images/img4.jpg' border="0"/>
<img class="image" id='img_5' src='images/img5.jpg' border="0"/>
</div>
</div>
and in the javascript I define:
onReady: function(){
// Create a new draggable for the div with an
// id of 'draggable'
new Ext.util.Draggable('draggable', {
revert: true
});
new Ext.util.Draggable('img_1', {
revert: true
});
new Ext.util.Draggable('img_2', {
revert: true
});
new Ext.util.Draggable('img_3', {
revert: true
});
new Ext.util.Draggable('img_4', {
revert: true
});
new Ext.util.Draggable('img_5', {
revert: true
});
Can somebody show me what I've done wrong, Thanks. (Note: The same code is working if I don't put <img>s inside <div>s)
My page has several draggable images and a drop item. My purpose is to drag images to the drop item. My page works fine. However if I put the images under 1 or 2 other div then it stops working. The snippet is below.
<div class='class1'>
<div id='someid' class="class2">
<div id="invalid" style="display:none">Don't drag me!</div>
<img class="image" id='img_1' src='images/img1.jpg' border="0"/>
<img class="image" id='img_2' src='images/img2.jpg' border="0"/>
<img class="image" id='img_3' src='images/img3jpg' border="0"/>
<img class="image" id='img_4' src='images/img4.jpg' border="0"/>
<img class="image" id='img_5' src='images/img5.jpg' border="0"/>
</div>
</div>
and in the javascript I define:
onReady: function(){
// Create a new draggable for the div with an
// id of 'draggable'
new Ext.util.Draggable('draggable', {
revert: true
});
new Ext.util.Draggable('img_1', {
revert: true
});
new Ext.util.Draggable('img_2', {
revert: true
});
new Ext.util.Draggable('img_3', {
revert: true
});
new Ext.util.Draggable('img_4', {
revert: true
});
new Ext.util.Draggable('img_5', {
revert: true
});
Can somebody show me what I've done wrong, Thanks. (Note: The same code is working if I don't put <img>s inside <div>s)