Reputation: 241
After declaring height()
variables for multiple loaded elements which have different variables for each, the animate()
function doesn't seem to be loading the variable excHeight
.
What would be the best way to use the value of excHeight
for the animate()
as below?
$(".exPand a").click(function (event) {
event.preventDefault();
var post_id = $(this).attr("rel");
var postHeight = $(this).closest('.boxy')
.find('.articleImageThumb')
.height();
var excHeight = $(this).closest('boxy')
.find('.articleImageThumb')
.find('.initialPostLoad')
.height();
$.ajaxSetup({cache:false});
$(this).closest('.boxy')
.animate({height: postHeight+excHeight}, 1000);
$(this).closest('.boxy')
.find('.articleImageThumb')
.animate({top: 0}, 1000);
$(this).closest('.boxy').find('.articleTitle')
.animate({bottom: excHeight}, 1000);
$(this).closest('.boxy').find('.postmetadata')
.animate({bottom: excHeight}, 1000);
});
Upvotes: 1
Views: 100
Reputation: 42166
Seems like it is not working because you forgot "dot" in boxy
class name: var excHeight = $(this).closest('boxy')
, must be like this: var excHeight = $(this).closest('.boxy')
Upvotes: 4