简体   繁体   中英

Jquery mouse hover issue

I am having a slight issue with my mouse hover function on my images. When you hover over one image it's causing the hover over state to be active with all the images. [click here][1] Does anyone know where i have gone wrong??

//javascript

$(".tint").hover(function(){
$('.hover-hide').toggleClass('hidden');
}); 

//HTML

<figure class="tint">
    <div class="hover-content hover-hide hidden">
        <a class="roll-over" href="#"><img class="img_hover" src="img/home-hover-bg.png" alt="hover"/></a>
    </div>
    </figure>
$(".tint").hover(function(){
    $(this).find('.hover-hide').toggleClass('hidden');
}); 

Use this to point the element that you are hovering.

$(".tint").hover(function(){
     $(this).find('.hover-hide').toggleClass('hidden');
});

In many object-oriented programming languages, this (or self) is a keyword which can be used in instance methods to refer to the object on which the currently executing method has been invoked.

Find the div corresponding to that image:

$(".tint").hover(function(){
    $(this).children('.hover-hide').toggleClass('hidden');
}); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM