views:

38

answers:

1

Hi,

Looking at the jquery demo at http://jqueryui.com/demos/droppable/#photo-manager, I'm trying to make the images in the Trash undraggable and am unable to do so. I've changed the demo so that the Gallery is no longer droppable, but the items in the Trash still follow my cursor if I mousedown. Of course, they have nowhere to go, so they revert back, but is there a way to make them ignore the mousedown to begin with?

Thanks for any info, -Tony

+3  A: 

see http://jqueryui.com/demos/draggable/#option-cancel

In the case of the demo, this line:

    cancel: 'a.ui-icon',// clicking an icon won't initiate dragging

Needs to change to:

    cancel: 'a.ui-icon, #trash li', // add selector for items in trash

I haven't tested, but it should work

Demonstration

Is that what you want? Also added #trash .gallery li img {cursor: default;} to the css.

ghoppe
See my demonstration. How is that not what he wanted?
ghoppe
It sure looks like what he wanted. I can't move any of the things that I've dragged into the circular file.
Peter Ajtai
You're right, my mistake, I misunderstood. +1
Mark
Hi ghoppe, thanks for the info and for explaining how the "cancel" option works. Unfortunately in my app it didn't work, but I worked around it by setting elt.draggable({containment: [0, 0, 0, 0]}) to commandeer the draggable functionality on that element.
Ton-Yun Fang