Hi,

At first blush, it appears that the use of $$() might be problematic. I was expecting to see something with Element.select(), which is described this way in prototype-160-api.pdf: "This method is very similar to $$() but can be used within the context of one element, rather than the whole document." Perhaps dropdown.select('ol') would yield the right set of elements?

all the best,
mtw

On Feb 15, 2010, at 4:43 AM, huckocs 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 prototype- scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype- scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/ group/prototype-scriptaculous?hl=en.


--
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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to