tags:

views:

118

answers:

2

I have three divs set up in the following way:

<div class="outer-div">
<div class="inner1"></div>
<div class="inner2" style="display:none;"></div>
</div>

I have the second inner div hidden via the inline style. What I am trying to accomplish is that when the outer div, or basically any of the content is hovered over then the inner2 would appear.

I am unfamilar with Prototype and having a terrible time trying to get my head around it. Missing jQuery but this time around Prototype is totally required.

Thanks in advance for any help!!

A: 

try something like:

$("outer-div").observe('mouseover', function() {
    $('inner2').setStyle({ display: 'block' });
});
lazerscience
While I think it's close, I couldn't get it to work. Could it be because the divs contain classes?
pixelflips
sorry, didn't see first that you used classes not ids for the elemens!but probably it makes more sense changing the html or add an additional id, because i think you just one element of all these divs, not many of the same class! so try it with <div id="outer-div">... same for the other divs!prototype's dollar function only works for ids http://en.wikipedia.org/wiki/Prototype_JavaScript_Framework#The_.24.28.29_function
lazerscience
@lazerscience http://www.prototypejs.org/api/utility/dollar-dollar
Rui Carneiro
A: 

Not too different from the other answers, but I'm just using the inner1 class as the thing observed.

$$('.inner1').each(function(item){
    item.observe('mouseover', function(evt){
        evt.target.siblings()[0].show();
    });
});
artlung