Own function with multiple "if" conditions in jquery
<p>Actually I whant to feed a variable "var xy" with diverent heights in dependence of more than one "if" condition. The best way to do this, is to create a custom function,isn't it?
Well, I don't know how to do that.
I've done something like this to get the height of diverent elements in dependence of the "item_xy" hasClass "current":</p>

<pre><code>$.fn.varheight = function() {
   if ($("item_1").hasClass("current")) { ($("#container_1").height();}
   if ($("item_2").hasClass("current")) { ($("#container_2").height();}
   if ($("item_3").hasClass("current")) { ($("#container_3").height();}
   if ($("item_4").hasClass("current")) { ($("#container_4").height();}
});
</code></pre>

<p>Think of a menu. If the first menuitem hasClass "current" get the height of one element, if the second menuitem hasClass "current" in stad of the first, get the height of another element ... an so on.. The elements to get the heigt from are not the menu or menuitems. These are just some divs with content and diverent selectors like "#container_1", "#container_2",....</p>

<p>After that I want to use the .varheight() as setter.</p>

<p>Please give me a hint.</p>
