Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-14-2008, 05:36 PM   PM User | #1
RadGH
New to the CF scene

 
Join Date: Oct 2008
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
RadGH is an unknown quantity at this point
script.aculo.us Draggables question

Scriptaculous Draggables website

I'm trying to create my own object class "tile", which essentially is like an icon on your desktop with functions like... tile.recycle (delete via effect.poof), tile.icon (icon element id) and more.

However, I don't fully understand the object scope of their classes. For example, this small bit of code allows me to drop my div on a 'recycler div' and it "poofs" (well, puffs) away with an animation.

Code:
Droppables.add('recycler',
{
	accept:'tile',
	onDrop:function(){
		Effect.Puff('tile_01');
	}
});
This does work for all the divs with class "tile", however, I need to take the dropped element's ID instead of using the static 'tile_01'. With the code above, dropping any tile will poof tile_01 (first div).

I tried using this, but I need more of a that. The "triggering div" you might call it. I've looked through the documentation, but it wasn't very helpful.
RadGH is offline   Reply With Quote
Old 10-14-2008, 06:40 PM   PM User | #2
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
so you're trying to figure out which draggable hit your droppable, right?

onDrop will automatically get the element that was dropped on it... then it's just a matter of getting the id. see below. identify() is part of prototype.


Code:
onDrop:function(element){
		Effect.Puff($(element).identify());
	}
that is untested, but based off my own working code. if it doesn't get you closer try dropping an alert in there to see what is being passed.
ohgod is offline   Reply With Quote
Users who have thanked ohgod for this post:
RadGH (10-15-2008)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:04 PM.


Advertisement
Log in to turn off these ads.