Animated Ajax Record Deletion

3 views
Skip to first unread message

David Behler

unread,
Jul 7, 2009, 8:36:05 AM7/7/09
to Prototype & script.aculo.us
Some time ago I came across the blog of David Walsh and his article on
"Animated Ajax Record Deletion Using MooTools" (http://davidwalsh.name/
animated-ajax-record-deletion-mootools). Sadly he uses MooTools and
not Prototype. But as I'm more and more trying to create my own
classes based on Prototype I wanted to create this functionality
myself!

And now it's done: Deletr is born!

A demo can be viewed here: http://www.davidbehler.de/projects/deletr
You can download it from here: http://www.davidbehler.de/index.php/file/view/8

I would really like to know what you guys think of this!

You might notice this:
if(!element.match('a')) {
element = element.ancestors()[0];
}
I did this in case it's not a link you click on but an image that's
wrapped in a link, e.g. <a href="test.php"><img src="test.png" /></a>
In this case var element = Event.findElement(ev); seems to return the
image and not the link. Any other way to fix this?

Greetz
Davd

T.J. Crowder

unread,
Jul 8, 2009, 4:42:42 AM7/8/09
to Prototype & script.aculo.us
Hi,

> In this case var element = Event.findElement(ev); seems to return the
> image and not the link. Any other way to fix this?

Event#findElement has exactly the functionality you need, I'd give the
docs[1] a good read.

[1] http://prototypejs.org/api/event/findelement

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

David Behler

unread,
Jul 8, 2009, 4:57:34 AM7/8/09
to Prototype & script.aculo.us
Thanks! That worked!

I'm still a beginner and trying to really get into Prototype...good to
know people here are willing to help :)
Reply all
Reply to author
Forward
0 new messages