Search code examples
jqueryrollover

jQuery Rollover


I'm simply hiding and showing a products descrption on rollover, can it be done better then this?

Its a little buggy when the mouse goes in and out

$("a.roll-over-trigger").hover(
   function() {
      $(this).next('.altProduct p').slideDown('300');
   },
   function() {
      $(this).next('.altProduct p').slideUp('300');
   }
);

a.roll-over-trigger is the image itself

and .altProduct p slides up over half of the image when hovered.

Here's a link http://tinyurl.com/d8dxd47

Thanks


Solution

  • You didn't provide any example, just a guess

    $("a.roll-over-trigger").on('hover', function(e) {
        $(this).next('.altProduct').find('p').slideToggle('medium');
    });
    

    An example here.