Using 'this' for more than one attribute on hover
I'm trying to get the text from the 'alt' part of the image to slideDown on hover and then slideUp once the cursor exits. The fade is working fine, but I cannot get the text to appear unless I use a class, the problem is when I'm using a class the text for all the images drops when hovering on one img.
Current code - not dropping any text
- $('img').hover(function() {
- $(this).css("opacity","0.4");
- $(this).html.attr('alt').slideDown("slow");
- },function(){
- $(this).css("opacity","1");
- $(this).html.attr('alt').slideUp("slow");
-
- });
Using a class for the text slideDown looks like this. But as stated, I'm not sure how to use 'this' in this type of situation?
- $('img').hover(function() {
- $(this).css("opacity","0.4");
- $('.text').slideDown("slow")
- },function(){
- $(this).css("opacity","1")
- $('.text').slideUp("slow");
-
-
- });
- });