Hi all,
getting stuck with scope, I'm a bit new to javascript so would
appreciate the help!
I'm attempting to loop through each <div class="ddBox"> and get the
highest <ol> in each <div class="ddBox">, then set the height of the
<div class="ddBox"> to the highest <ol>. The problem is that its
looping through and getting the highest <ol> in the window.object and
applying this to each div. I'm sure its something simple but I'm
banging my head on the table here!
I've looked into binding but can't seem to get it right :(
<div class="ddBox">
<ol>
<li>
<a href="#"></a>
</li>
</ol>
<ol>
<li>
<a href="#"></a>
</li>
</ol>
<ol>
<li>
<a href="#"></a>
</li>
</ol>
</div>
<div class="ddBox">
<ol>
<li>
<a href="#"></a>
</li>
</ol>
<ol>
<li>
<a href="#"></a>
</li>
</ol>
<ol>
<li>
<a href="#"></a>
</li>
</ol>
</div>
<div class="ddBox">
<ol>
<li>
<a href="#"></a>
</li>
</ol>
<ol>
<li>
<a href="#"></a>
</li>
</ol>
<ol>
<li>
<a href="#"></a>
</li>
</ol>
</div>
$$('.ddBox').each(function(dropdown){
var ddHeight = $$('ol', this);
var ddBoxHeight = $$('.ddBox');
var max_height = ddHeight.invoke('getHeight').max();
ddBoxHeight.invoke('setStyle', {height: (max_height) + 'px'});
console.log(max_height);
},this);
Any help appreciated!
Cheers
Huck
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.