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

8 Responses to “Magnet poetry with Ajax”

  1. Sune Says:

    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.

  2. stfi Says:

    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.

  3. Madsen Says:

    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. :)

  4. stfi Says:

    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

  5. Madsen Says:

    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

    ’s, as you can see in the source. :) (Making it images would be too much work.)
  6. Madsen Says:

    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. ;)

  7. stfi Says:

    - 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.

  8. stfi Says:

    Ohh, the transparency? I couln’t remember if it were there in the first place.

Leave a Reply

 Theme Brought to you by Directory Journal and Elegant Directory