SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dragging between lists

    Hey there,

    I am working on creating a script that allows a user to drag and drop between multiple sortable lists. I've got the dragging working fine, and I have a good plan for the dropping so that's sorted out.

    However, it turns out that when the user decides to click and drag a list item, I want to replace the list item with a dummy holder (no problem there got that worked out) and temporarily attach the list item to its own dummy ul item (so the user has the impression that he is grabbing the list item). Then when the user drops the list item, I'll insert it into the appropriate location in one of the lists (or move it back to the beginning if they drop it in the middle of nowhere).

    The problem I'm having is in determining the exact location to place the dummy UL so that the user doesn't feel like the list item is jumping around when they click on it.

    Also, it occurs to me that I will need to solve essentially the same problem when determining the drop location for the list item, since I plan on comparing the page location of the moving list item with the page location of the static list items.

    So basically, this boils down to, how to do I find the exact page location of a LIST element within a UL element?
    Last edited by dwees; Jan 11, 2007 at 22:57.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi dwees,

    This is going to be very dependent on the html structure and css settings. Do you have a demo/test page so we can see the html/css?

    My first thought is that you'll need something like xPageX and xPageY - but they are not foolproof. Much depends on the html/css.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    element location

    Hey Mike,

    Thanks for your interest. Anyway, my very early demonstration page is up at http://www.unitorganizer.com/sortable.

    The problem will be, I won't have too much control over the structure of the lists since they will be generated by a wide variety of different database configurations (since I'm writing this as part of a module for a large CMS community). What I expect is that I will have multiple lists, each with multiple child lists.

    Example:

    • One
      • A
      • B
      • C
    • Two
      • a
      • b
        • i
        • ii
        • iii
        • iv
        • v
      • d


    • Five
    • Six
      • I
      • II
      • III
      • IV
    • Seven


    However, I do have control over the CSS, so if I need to make some changes to make this work, then I'm able to do so.

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xPageX and xPageY

    Hey Mike,

    These functions work great but something screwy is happening when I move the selected list element to the new ul, it seems to screw up my place holder list element, and I have NO idea why, I can't see why there would be any conflict at all.

    I'll see what I'm missing, but if you see it, that would be appreciated, note that the placeholder shows up completely fine before I do the move.

    Dave


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
  •