| |
Prototype & script.aculo.us |
for the first question, I think that you should style the inserted
element or use a SPAN tagb instead of a DIV tag:
the DIV expand its width by default to it's contener width,
the SPAN just enclose inside content.
for the second question, there is no siimple way, scriptaculous don't
handle that, but I remember that some projects have modify default
scriptaculous behaviour ==> Have a look at http://scripteka.com/
--
david
On 30 juin, 07:58, Mike <thej...@gmail.com> wrote:
> Here is the javascript functions I created:
> function createCanvas(){
> Droppables.add('sigImage', {
> accept: 'draggable',
> hoverclass: 'hover'
> });
> }
> function createNewDraggable(elementId){
> new Draggable(elementId, {
> handle: 'sigImage',
> ghosting: true
> });
> }
> function newElementMenu(){
> document.getElementById('newElementName').value = '';
> Effect.Appear('createNewElementMenu', {duration: .3});
> }
> function newElement(elementName){
> Effect.Fade('createNewElementMenu', {duration: .3});
> document.getElementById('sigImage').innerHTML += '<div id="' +
> elementName + '">The next element!</div>';
> createNewDraggable(elementName);
> }
> Here is the nesting:
> <div id="sigImage" style="width: 500px; height: 100px;
> background-color: gray; color: black; border: 1px black; overflow:
> none;">
> <div id="dragme">Drag me!</div>
> </div>
> Another not so important thing is how can I get the elements to remain
> in the div and not be dragged outside of it?