Mouseover and Mouseout function jQuery

Mike picture Mike · Mar 2, 2011 · Viewed 32.8k times · Source

I have this script:

$("#teaser ul.buttons li").mouseover(function()
    {
        $("a",this).animate({ left: '0' },350);
    }).mouseout(function()
    {

        $("a",this).animate({ left: '-11px' },350);
    });

But when i now hover over the a element. The mouseover and mouseout going continu. How can i change this script. That when i hover of the a element. That the mouseout launch when i hover off the element.

Answer

Rafay picture Rafay · Mar 2, 2011

use mouseenter and mouseleave instead of mouseover and mouseout