Hovering Div Reveals Hidden Div - Prototype

I have three divs set up like this:

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

      

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

I disagree with the prototype and am terribly trying to hug it. Missing jQuery, but this time Prototype is completely required.

Thanks in advance for your help!

+2


a source to share


2 answers


try something like:



$("outer-div").observe('mouseover', function() {
    $('inner2').setStyle({ display: 'block' });
});

      

0


a source


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

as an observable.

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

      



0


a source







All Articles