SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Script.aculo.us Drag n' Drop issue

    I am using the drag and drop script found here, http://script.aculo.us/. Yes i know its a hog. Anyways, i am using the script pretty much out the box with link in the sortable div. My issue is that when clicking on a link, if you at all move the mouse, its sorts to the direction you ever so slightly moved. This is driving me nuts. I have tried to add pausing functions here and there trying to create a couple millisecond pause before dragging so the click can take effect, but i have had no luck.

    Can anyone suggest a way to alter the script, so that if i click on the link in the div, it wont drag before the href is called. Thanks. Here's my example code.

    Code:
    <div id="page">
    
    	<?php /*   div sits in a TD cell. div ID can be anything alphanumeric. HTML inside DIV is ok.  */ ?>
    	<div id="group" class="section">
    		<h3 class="handle">Group 1</h3>
    
    		<?php /*   div ID can be anything alphanumeric, after *item_*. HTML inside DIV is ok.  */ ?>
    		<div id="item_1" class="lineitem"><a href="index.php">Item 1</a></div>
    		<div id="item_2" class="lineitem"><a href="index.php">Item 2</a></div>
    		<div id="item_3" class="lineitem"><a href="index.php">Item 3</a></div>
    		<div id="item_4" class="lineitem"><a href="index.php">Item 4</a></div>
    		<div id="item_5" class="lineitem"><a href="index.php">Item 5</a></div>
    	</div>
    </div>
    
    <script type="text/javascript">
    	// <![CDATA[
    
    	/*   add each ID from group level div.   */
    	sections = ['group'];
    
    	/*   this watches for event changes like drag and drop action   */
    	Event.observe(window,'load',init,false);
    	function init() {
    
    		/*   add a sortable.create for each group level div   */
    		Sortable.create('group',{tag:'div', dropOnEmpty: true, containment: sections, only:'lineitem'});
    	}
    
    	/*   add sortable.create for *page* div   */
    	Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
    	// ]]>
    </script>

  2. #2
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you can disable the ghosting effect by setting some parameter, but what is the point to make those sortable element only to be sorted when you have mouse released?

  3. #3
    SitePoint Addict scoobasteve1982's Avatar
    Join Date
    Apr 2007
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your draggables parameters, try setting ghosting: true or to false.
    Last edited by scoobasteve1982; May 17, 2007 at 10:13. Reason: spelled ghosting wrong..whoops :) thanks SimplyFu

  4. #4
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ghosting : true // not gosting


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •