Page 1 of 1

jquery combine this and class selector

Posted: Wed Apr 22, 2009 12:56 am
by invisibled
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


hey ya'll

i am trying to to write a script that will detect a hover over the div "module" and then fade in the div "info" inside "module". I am using jquery, here is what i have.

Code: Select all

 
$(".module").hover(
     function(){$(this $(".info")).fadeIn("fast");}, 
     function(){$(this).fadeOut("fast");}
);
 
The problem is, using this (to target the specific module) and then using .info. jquery doesnt seem to like that. i can use just "this" and it will fade in and out the entire module, but i need it to fade in and out a div inside module. Any Suggestions, here is my html for module

Code: Select all

 
<div class="module id43">
  <img src="lib/img/tmp/Picture%204.png" alt="" height="359" />
  <div class="info">
    <h2>Matt Saunders</h2>
    <p>Ventosus feugait iriure incassum abluo te sed eros epulae blandit valetudo eu praesent regula. Luptatum lobortis jus nulla os appellatio exerci inhibeo, volutpat iaceo.</p>
                    
    <div class="category">Visual Arts</div>
    <div class="type">Video</div>
  </div>            
</div>
 

pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: jquery combine this and class selector

Posted: Wed Apr 22, 2009 10:04 am
by pickle
I've been trying to find a way to combine this and another selector for months - to no avail. The closest I've got is using .children()

Re: jquery combine this and class selector

Posted: Wed Apr 22, 2009 11:20 am
by kaszu
jQuery("expression", "context")
A DOM Element, Document or jQuery to use as context

Code: Select all

$(".module").hover(
    function() {
        $(".info", this).fadeIn("fast");
    },
    function() {
        $(this).fadeOut("fast");
    }
);