Forum: Rails Spinoffs (closed, excessive spam) Problem with Sortable.create scroll (also Draggable scroll)

Posted by Vidal Graupera (sorcerous)
on 2008-06-24 01:49
(Received via mailing list)
Hi,

I am trying to use the "scroll" property of Sortable (which I know
just passes through Draggable) to scroll a div that contains a list.
The list is a Sortable and when someone scrolls an element off the top
or bottom I need the container to scroll.

This works fine *except* when you drag an element off the top (or
bottom) of the container. The element you are dragging will flicker,
and behave weirdly. Take the element at the top of the list, move it
up a few pixels and just hold it with mouse down. It will "float" up
as well.

I have verified this on FF3, Safari and IE. It works fine when scroll
property is set to window, but I need to use a containing div instead.
I am using latest scriptaculous from github and prototype 1.6.0.2.

Here is an excerpt of the relevant parts of my code that shows this
problem. Any help appreciated, or a working example would be greatly
appreciated.

Thanks,

Vidal.


<script type="text/javascript">
//<![CDATA[

document.observe("dom:loaded", function() {
  Position.includeScrollOffsets = true;
  Sortable.create('sortable_items',{
    scroll: 'your_spin_list'
  });

  // this fails too
  var mydrag = new Draggable('test', { scroll: 'your_spin_list' });

});


//]]>
</script>
<style>
#your_spin_list {overflow:scroll; height: 200px;}
</style>

</head>

<body>

<div id="your_spin_list">
  <ol id="sortable_items">
     <li>blah blah blah</li>
     <li>one two three four</li>
     <li>alpha beta gamma delta</li>
     <li>scriptaculous prototype yui etc</li>
  </ol>

  <span id="test">dragging this also off the top misbehaves</span>
</div>
Posted by markb (Guest)
on 2008-06-26 11:44
(Received via mailing list)
I experienced the same problem on my current.
The problem can not be solved with the current library I think.
What is causing the strange behaviour when you try to drag an element
into or out of the
'your_spin_list' is the overflow:scroll for that element. Get rid of
it and everything should behave normal again.
I read the same conclusion in the prototype bungee book'... it just
isnt possible to drag things in or out of
containers that have an overflow set to scroll. Sorry..
This topic is locked and can not be replied to.