Trying to get the right Object to animate.
http://jsfiddle.net/nakins/SUeyb/
I found some code that would open/expand and close/collapse a div. Once the Div was expanded, I needed to put in other clickable elements, so I removed the .box class, which worked. And, I did some other adding and removing of classes to get a "close" link. But, I'm not animating the original div, but animating the elements inside the div..
In this part of the code, shown below, closes the div. But I'm not sure what is pointing or referencing what. Is $(this) pointing to a div with the .close class or .cloned class. Any help would be appreciated.
P.S., I know that this may not be the best way to write this code, I haven't done much javascript or jquery.
thank you,
- $("body").delegate('.close','click', function(){
var cloned = $('.cloned');
var clone = $('this');
var pos = cloned.position();
var w = cloned.width();
var h = cloned.height();
$(this).animate({
width: w + 'px',
height : h + 'px',
top: pos.top + 'px',
left: pos.left + 'px'
},300, function(){
$('.cloned.active').remove();
cloned.addClass('box');
cloned.removeClass('cloned');
});
});