PDA

View Full Version : Getting coordinations... script.aculo.us



Hitman
19-05-2008, 03:54 PM
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.

Movieen
19-05-2008, 04:04 PM
Try cookies?

Hitman
19-05-2008, 04:08 PM
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.

Robbie
19-05-2008, 04:10 PM
http://www.habboxforum.com/showthread.php?t=483445

Search next time Mr. S Mod :P

Hitman
19-05-2008, 04:12 PM
http://www.habboxforum.com/showthread.php?t=483445

Search next time Mr. S Mod :PI did use search, must have been searching the wrong thing? :P Cheers. :D

How would I be able to change the alert so it was something like a var which can then be inserted into a db?

Robbie
19-05-2008, 04:19 PM
I'd use AJAX to load a save page and then do something like


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')

Hitman
19-05-2008, 04:28 PM
I'd use AJAX to load a save page and then do something like


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')


:D Thanks a lot, I understand what to do with that. :P Cheers!

Invent
19-05-2008, 04:41 PM
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.

loserWILL
21-05-2008, 08:48 PM
Could someone fully explain how to save the coordinates, I think it will come in handy for a small personal project of mine.

Want to hide these adverts? Register an account for free!