Nick Ring
Nick Ring

Reputation: 29

jQuery hover - mouseout not working

I have the following script here... It works when I mouseover the item... but when the mouse leaves, it doesn't hide anything. In fact, it just seems like an endless loop. Help please! :-)

<script type="text/javascript">
$(document).ready(function() {
        // Handler for .ready() called.
    $(".hover").hover(
      function () {
         $('.hide').hide();
        var clss = $(this).attr('id');
        $('.pop_'+clss+'').show('slow');
      }, 
      function () {
        $('.hide').hide('slow');
      }
    );


});
</script>

Upvotes: 0

Views: 545

Answers (1)

user1827044
user1827044

Reputation: 176

The fly in boxes are gaining focus as soon as they come in, which is triggering the mouseleave function you implemented and they disappear. In order to get the functionality you want you need either:

  1. Bind the mouseleave to the .hide divs that are appearing
  2. Make it so the new divs don't overlap the .hover elements

Upvotes: 1

Related Questions