SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Location
    Bury St Edmunds, United Kingdom
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery draggable, reverting an element to its start point after having being dropped.

    Having read through the first few chapters of the jquery Novice to Ninja book, and borrowing heavily from a tutorial from elated(dot)com, I am trying to create a drag and drop page, whereby a draggable element reverts to its start point if not dropped in an appropriate area, but snaps to that area if correct. I seem to have this behavior working ok.

    What i would like to do is remove the successfully dropped element and have it revert to its original position, if the user subsequently decides to remove it.

    Grateful for any pointers / advice
    Attached Files Attached Files

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by CraigRush View Post
    What i would like to do is remove the successfully dropped element and have it revert to its original position, if the user subsequently decides to remove it.
    The way that I would do it, is when the stop even if fired (dragging has stopped) I would check if the element is in an appropriate area, and if not I would set the revert option on the element which will return it back to it's home area. The drag event could then remove that revert option from whatever it's dragging too.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Oct 2012
    Location
    Bury St Edmunds, United Kingdom
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply - still a bit of a noob with jquery. Will take a look and try and work it out

  4. #4
    SitePoint Member
    Join Date
    Oct 2012
    Location
    Bury St Edmunds, United Kingdom
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After playing about with this for a day or two, I changed tack and have started working with sortable, which seems to work better for me.


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
  •