Magnet poetry with Ajax
Based on DOM-Drag (which is really nice btw), I hacked up a little thingy for the Migato Estalo Co. website. (It’s in danish, but you know the concept.)
I’m growing more and more fond of Ajax (or rather XMLHttpRequest). It’s really nice, but unfortunately it’s not very Lynx-/Links-friendly, but I guess that’s the price to pay and I guess it’s all part of development. (I mean, you usually ditch something old in favour of something newer and smarter - though not necessarilly better in every respect.)
November 24th, 2005 at 1:08 am
Ajax IS nice - although you’ve hit the nail on the head regarding friendliness t’wards older browsers.
In my opinion it is an excellent tool for backends and the like where you’ve got some sort of controlled audience, so to speak.
Im looking forward to understanding what the heck I’m actually commenting on here - I don’t know how to make webpages. But I like’m.
November 26th, 2005 at 3:51 pm
That is dead fun. And a superb idea. I might steel it. Or at least the kind of interaction on a site i have to copy.
- But i can’t help my self for exploring error. Tell me, what controls what object (image with a word) is to be ontop? It seams that they are all stacked in one big pile in a predefined order. That is, fx, the same object will be the top object indepently of the order one (the user) stack them on the screen. Maybe that is just part of the implementation.
November 26th, 2005 at 4:12 pm
Yeah, it’s just one big pile - at least for now.
I’ve got a dragStart and dragEnd handler available, so I could use them to modify the z-index while/after dragging. I haven’t really thought much about it, but it’s an interesting point. :)
November 26th, 2005 at 8:29 pm
Im assumeing that only one object can be moved by the time. Then, darling, if there is a way/function/handel to know what object is being moved, i guess, resorting the z-index’s will be sufficient? In other words: Then maybe it will work just by changing the z-index of the object that is being moved, so it becomes the top object, and at the same time move all the objects, previusly above the now moveing object, down a tad.
What is stored for each object? Id, path-to-image, x-, y-, z-index? Is the code in SVN? How do i get access?
xoxx
November 26th, 2005 at 11:02 pm
Yeah, I thought of the same thing. Don’t know if it’s really worth implementing though, but I’ll probably try - at least just for the sake of it.
The code isn’t publically available because it’s fugly, but most of the interesting parts you can actually read in the HTML source. What I’m doing behind the scenes with PHP is really just simple interaction with MySQL.
In the DB table I’ve got the following columns: id, word, x and y. And btw, the words are not images, they’re just in styled
November 27th, 2005 at 9:46 am
Ok, implemented a dynamic z-index. It was kinda hard actually, since I hadn’t thought of it from the beginning, so now the code is even more fugly than before. :(
I also did a few other updates, but I’ll let you figure those out for yourself. ;)
November 27th, 2005 at 1:33 pm
- Yeah, i found out it wasn’t images
- Cool. It works. Great job. I know it wasn’t a big deal. I just couldn’t help asking, since it would be cool. I think. It’s the way this virtuel implementation of the “game” is made consistent, i think. If it was to be as if it was “real” no words were to be ontop of each other. That might be harder to code.
- Grr. I can’t figure what else you ave updated.
November 27th, 2005 at 1:36 pm
Ohh, the transparency? I couln’t remember if it were there in the first place.