sortable

1 view
Skip to first unread message

wonderpix

unread,
Dec 18, 2009, 8:17:41 PM12/18/09
to Prototype & script.aculo.us
Hi

Maybe this is a simple task, or maybe it is an impossible one, I dont
know. But here it goes:

Assume you have

<div id="containerDiv">
<div id="div_1"><img src="arrow.gif" ><a href="page.html">page</a></
div>
<div id="div_1"><img src="arrow.gif" ><a href="page.html">page</a></
div>
<div id="div_1"><img src="arrow.gif" ><a href="page.html">page</a></
div>
</div>

I want the img tag to be the only draggable element. So when you are
with the mouse over the image, it will be possibile to drag. But then
ALL THE DIV should be dragged. Is that clear?

I dont know how to do this. If I add the option tag: img to Sortable,
it doesnt help. I then tried also to give the images an id, like
img_1, img_2 and so on. Is this possible to solve?

Alex McAuley

unread,
Dec 19, 2009, 8:08:46 AM12/19/09
to prototype-s...@googlegroups.com
in draggable there is a parameter "handle" witch if i recall correctly takes
a classname...

SO add a classname to each image of the same name (<img class="drag-me" ...
/> <img class="drag-me" .... /> ....)

In your draggable code
new Draggable('containerDiv),{
handle:'.drag-me'
// other options
}); //

untested but i dont see why not


Alex Mcauley
http://www.thevacancymarket.com

> --
>
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scripta...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>
>

Walter Lee Davis

unread,
Dec 19, 2009, 9:31:15 AM12/19/09
to prototype-s...@googlegroups.com
Exactly right, except you don't need to put the dot in front of the
classname.

handle:'drag-me'

Walter

Alex McAuley

unread,
Dec 19, 2009, 9:38:29 AM12/19/09
to prototype-s...@googlegroups.com
Ta!! ..

Been a while since i used Draggable


Alex Mcauley
http://www.thevacancymarket.com
----- Original Message -----

wonderpix

unread,
Dec 19, 2009, 1:02:42 PM12/19/09
to Prototype & script.aculo.us
Oh thank you Alex and Walter!

On 19 Dec, 15:38, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:


> Ta!! ..
>
> Been a while since i used Draggable
>

> Alex Mcauleyhttp://www.thevacancymarket.com

Reply all
Reply to author
Forward
0 new messages