0

I'm trying to face a particular class .mosaic-block to fade on clicking this:

<a href="#">
  <div id="t0" class="n0 lfloat"><img src="images/home.png"><br>Home</div>
</a>

My Jquery code is:

<script type="text/javascript">
$(function () {
$('a #t0').click(function() {
  $(".mosaic-block").animate({ 
        opacity: 0.0
        }, 1500 );
    }); 
});
</script>

But I'm not getting the desired results.

EDIT#1 My .mosain-block HTML code:

<div class="mosaic-block bar">
    <h4>Sloppy Art</h4>
    <p>abcd</p>
</div>
xan
  • 4,640
  • 13
  • 50
  • 83

2 Answers2

4

Your code is fine.

You can see it in action here.

So the error is elsewhere. For example in the jQuery import (yes, I got a hint on this one ;) ) which could look like this :

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
0

Why not use the inbuilt fadeOut() method

$(".mosaic-block").fadeOut(1500);
Sushanth --
  • 55,259
  • 9
  • 66
  • 105
  • 3
    Not necessarily since fading out will affect the layout `display:none`.. Animating the opacity only affects the visibility. – wirey00 Jan 04 '13 at 19:13