How to identify which link triggered a .hover ()?

2

I am not able to use this here, to identify which of the links I am passing the mouse, when I move the mouse in one of the links it activates the two links and this is not to happen. I'm also having trouble hiding .post-prev and .post-next .

HTML

<a href="#" class="btn-abs prev-new hide show_post">&#9668;</a>
<a href="#" class="btn-abs next-new hide show_post">&#9658;</a>

JS

$(document).ready(function () {

    $(".post-prev, .post-next").hide();

    $('.show_post').hover(function(){
        $('.post-prev, .post-next').animate({width: '20%'}, 300).show();
    }, function(){
        //$('.post-prev, .post-next').animate({width: '0'}, 300);
    });
});
    
asked by anonymous 14.04.2014 / 20:16

1 answer

1

When you hide, hide only the item that you left this ...

$(document).ready(function () {
    $('.show_post').hover(function(){
        $(".post-prev:visible, .post-next:visible").hide();

        $(this).animate({width: '20%'}, 300).show();
    }, function(){
        $(this).animate({width: '0'}, 300).hide();
    });
});
    
14.04.2014 / 20:25