views:

10139

answers:

3

I've got a couple of divs in a page which hold simple HTML & images. The divs each have unique ids.

I'd like it so that when the page loads the contents of the div are say, 60% but on mouseover the fade in at 100%. On mouseout they would go back to 60%.

The site is built in Joomla 1.5.x so already loads the mootools 1.11 library. I was looking for example code on the net and found lots of references for fading the opacity of images with jQuery but not all that much for mootools.

Any pointers would be appreciated :)

A: 

You may be able to wrap the image into a div and use something like this to fade?

Fx.Style("div1", "opacity").start(1.0);
Frost
I've added this to my test page. How would I go about making them change on mouseover? I should have said that I've no experience with mootools
I do not have experince with mooTools, but it can be done using javascript: I saw it inhere: http://forum.mootools.net/viewtopic.php?id=5125, and to get the mouseover effect then just call it onmouseover and onmouseout
Frost
A: 

Found a solution, well sort of. It works in mootools 1.2.1. I've tweaked the code to fade divs and not img.

I put this in my head:

<script type="text/javascript"  src="mootools-1.2.1-core-yc.js"></script>  
<script type="text/javascript">

    var fade_in = 1;
    var fade_out = 0.5;

</script>
</head>
<body onload="$$('div.box_panel').fade(0.5);">

and then this on my divs.

<div id="box1" class="box_panel" onmouseover="this.fade(fade_in);" onmouseout="this.fade(fade_out);">
        <h2>Box One</h2>
        <p>This is a content box and some sample content to pad it out.</p>
</div>

Problem now is I'm not sure how to get this same effect in 1.11

why don't you just upgrade or use both? ..does the fade function not exist in the 1.11?
Frost
Can't upgrade as other Joomla components may 'break'. I've read that V1.6 is supposed to be moving to mootools 1.2 but for the moment the compatibility mode is supposed to be iffy. Will give it a try.
A: 

Hi gavjof

Have you able to do this in MooTools1.1. I am also having a same kind of requirement.

If you have the code, could you please share with me @ [email protected]

Malaiselvan