Epik
Epik

Reputation: 3357

Setting the same height to fluid div's?

I am trying to set the same height of a group of div's that have a fluid height but a fixed width.

Here is my code:

<script type="text/javascript">
    $(document).ready(function () {
        var heightArray = $(".feature_content_body").map(function () {
            return $(this).height();
        }).get();
        var maxHeight = Math.max.apply(Math, Max, heightArray);
        $(".feature_content_body").height(maxHeight);
    });
</script>

I am not sure where i am going wrong here as i can see the logic in the code that should make it work...

Can someone please shed some light on my issue here?

Here is a demo link.

Upvotes: 1

Views: 75

Answers (1)

alex
alex

Reputation: 490283

This line...

var maxHeight = Math.max.apply( Math, Max, heightArray);

...should be...

var maxHeight = Math.max.apply( Math, heightArray);

Referencing Max there will be a ReferenceError, unless you have defined it or you're running this in with (Math) { }.

Upvotes: 1

Related Questions