I am trying to create a simple text accordion which calculates each panel's height and return this value as a variable. I can get values with if statements like `if ( i === 0 ) { $(this).height(); }` but can't get this variable to the outside.[I can do this without using variable but it became useless in long term.](http://jsfiddle.net/Aw39W/48/)

**Brıefly:** I want to calculate each element's `height` and use this variable inside `click` function.

**[Here is jsFiddle which includes the problem.](http://jsfiddle.net/Aw39W/59/)**

```
var panel = $('.holder div');
var trigger = $('a');

panel.each(function(i) {
    //problem starts when i try to calculate each ele's height
    var eachEleHeight = i.height();

    trigger.click(function() {
        $(this).prev('div').animate({'height':eachEleHeight+'px'},500);

        //this works widthout var eachEleHeight but became useless
        //$(this).prev('div').animate({'height':'300px'},500);
    });

    //this is for hiding text at doc.ready
    panel.css('height','56px');
});​

```