HI to all, firts, gretings, second excuse my english, i'm spanish
native talker, go to thye point
i have a page with severals divs with images that are created dynamic,
what i need i that when the last div is created (lets name newdiv), i
can drag and drop from all the divs existing in the page (lest name
olddiv1, olddiv2, olddiv3), so far thats ok i altered the function to
create, for dropping only in the newdiv, my problem is that in that
newdiv i can drag and drop the images for ordering
if you dont understant that i wrote, here mi code
-html-
<div id="page">
<div id="createNew">
<h3>Create New Group</h3>
<input id="sectionName" size="25" type="text">
<input onclick="createNewSection();" value="Crear Nueva Galeria"
type="button">
</div>
<div style="position: relative;" id="group1" class="section">
<h3 class="handle">Group 1</h3>
<div id="item_francoise" class="imagen"><img
src="th_00002.jpg"></div> *
<div id="item_carola" class="imagen"><img
src="th_00003.jpg"></div>*
</div>
<div style="position: relative;" id="group2" class="section">
<h3 class="handle">Group 2</h3>
<div id="item_amanda" class="imagen"><img
src="th_00010.jpg"></div> *
</div>
</div>
-html-
* images reading from a database
-javascript-
sections = ['group1','group2','group3'];
function createNewSection(name) {
var name = $F('sectionName');
if (name != '') {
var newDiv = Builder.node('div', {id: 'group' +
(sections.length +
1), className: 'section', style: 'display:none;' }, [
Builder.node('h3', {className: 'handle'}, name)
]);
sections.push(newDiv.id);
$('page').appendChild(newDiv);
Effect.Appear(newDiv.id);
destroyLineItemSortables();
createLineItemSortables();
createGroupSortable();
}
}
function createLineItemSortables() {
var largo = sections.length;
for (var i = 0; i < sections.length; i++)
{
if (i!=largo-1)
Sortable.create(sections[i],{tag:'div',
dropOnEmpty: false, only:'imagen',constraint:false});
else
{
Sortable.create(sections[i],
{tag:'div',dropOnEmpty: true, containment:sections,
only:'imagen',constraint:false});
}
}
}
function destroyLineItemSortables() {
for(var i = 0; i < sections.length; i++) {
Sortable.destroy(sections[i]);
}
}
function createGroupSortable() {
Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
}
--
if you can see i modify the function createLineItemSortables() , for
only the last div is created can accept droppable from others, the
problem, is that i nedd to be able rearrange the items in that last
one, in this moment only accept the drop item and "put" in the lastone
if you dont understand anything i can wrote in spanish if it helps
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.