tags:

views:

77

answers:

4

I would like to be able to fadeout this class

<h2 class="care-home-fees"><a title="Care Home Fees" href="#">Text</a></h2>

and fade in this

<h2 class="care-home-fees-over"><a title="Care Home Fees" href="#">Text</a></h2>

Notice there are two separate images

Here is my current markup which doesnt seem to work

$(document).ready(function(){  

$("h2.care-home-fees").hover( 
  function () {
    $(this).addClass("care-home-fees-over");
  },
  function () {
    $(this).removeClass("care-home-fees");
  }
);  

});

and the button printed before any change

<h2 class="care-home-fees"><a title="Care Home Fees" href="#">Text</a></h2>
+2  A: 

You might want .animate() instead of .addClass() or .removeClass().

What you want to do with CSS classes is in JQuery UI.

http://api.jquery.com/animate/

Daniel A. White
Thanks for you help, how do i animate between classes?
Andy
Daniel A. White
A: 

You'll need to use jQuery UI for this. I would refer you to the documentation (here), but it seems to be broken at the moment. You'll want to use the addClass and removeClass methods mentioned there (not the default jQuery ones).

Edit: see Daniel's link!

Will Vousden
Thanks for your input
Andy
A: 

first you need to download jquery i have jquery-1.3.2.min.js, but if you want the final release jQuery 1.4.1

change <h2 class="care-home-fees"><a title="Care Home Fees" href="#">Text</a></h2> to

<h2 class="care-home-fees"><a id="j" title="Care Home Fees" href="#">Text</a></h2>

you have to add the jquery file in your html..as i added it below::

//this is the start of the head
<head runat="server">
    <title></title>
// i added jquery-1.3.2.min.js file here
    <script src="jquery-1.3.2.min.js" type="text/javascript"></script>

<script>
  $("h2").click(function () { 
  $(document.getElementById('j')).fadeOut("slow");
$("a:hidden:first").fadeIn("slow");
  });
  </script>

//this is the end of the head
</head>

i hope it works..

jjj
thanks jjj ill see how it goes now and come back to you
Andy
No it didnt work, it fades out another link on the page then straight back in again.
Andy
let "Care Home Fees" visible=false
jjj
A: 
$(document).ready(function(){

         $('#wm').hover(function(){
            $('#wm .bld').stop().fadeTo(300, 0);
         }, function(){
            $('#wm .bld').stop().fadeTo(300, 1);
         });

         $('#ch').hover(function(){
            $('#ch .bld').stop().fadeTo(300, 0);
         }, function(){
            $('#ch .bld').stop().fadeTo(300, 1);
         });
});
Andy