Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default Getting coordinations... script.aculo.us

    Hey, I'm using script.aculo.us for this page to make the logos draggable. (http://theuge.net/index4.html)

    I want it so I can move the logos around, and them press a button and it saves the positions of all the logos with the name, in a database. I can do the MySQL database, but I've no idea how to get the coords or save them...

    I've been using google, but alas, I can't find anything.

    If anybody can point me in the right direction I'd be grateful.

    Tom.

  2. #2
    Join Date
    Apr 2008
    Location
    CARDIFFFF!
    Posts
    250
    Tokens
    0

    Default

    Try cookies?

  3. #3
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    The way I'll do it is users registering and the position they chose will be sorted in the db under their username/id and the login will use cookies, so the main page will get their cookie, find the coords for the logos in the db and display them.

    Just dunno how to get the coordinations.

  4. #4
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    1,290

    Latest Awards:


  5. #5
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Robbie! View Post
    I did use search, must have been searching the wrong thing? Cheers.

    How would I be able to change the alert so it was something like a var which can then be inserted into a db?
    Last edited by Hitman; 19-05-2008 at 04:13 PM.

  6. #6
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    1,290

    Latest Awards:

    Default

    I'd use AJAX to load a save page and then do something like

    Code:
    var x = document.getElementById('DIVNAME').style.left;
    var y = document.getElementById('DIVNAME').style.top;
    ajax_page_pls_cookies_ftw('savey.php?x=' + x + '&y=' + y + '', 'fantasticdiv')

  7. #7
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Robbie! View Post
    I'd use AJAX to load a save page and then do something like

    Code:
    var x = document.getElementById('DIVNAME').style.left;
    var y = document.getElementById('DIVNAME').style.top;
    ajax_page_pls_cookies_ftw('savey.php?x=' + x + '&y=' + y + '', 'fantasticdiv')
    Thanks a lot, I understand what to do with that. Cheers!

  8. #8
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Code a function that is ran onmousedown so the div's z-index (zIndex) attribute is increased to the highest amount throughout the divs and + 1 to it.

    This makes it so that when the div you're dragging is dropped, it will be on top of the other divs.

  9. #9
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Could someone fully explain how to save the coordinates, I think it will come in handy for a small personal project of mine.

Posting Permissions

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