This is my first attempt at answering a question here, so "use with
caution"...

       var max_Height = 0;

        $$('.ddBox').each(function(dd) {
                max_Height = Math.max(max_Height,
dd.select('ol').invoke('getHeight').max());
        });

        $$('.ddBox').invoke('setStyle', {height: (max_Height) + 'px'});

There's probably a shorter way, and hopefully someone will post it,
but this seems to work.
Although, when running it some Divs overlap, so I'm not sure if the
results are what you are looking for.


On Feb 15, 8:43 am, huckocs <[email protected]> wrote:
> 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.

Reply via email to