I'm trying to make a small animation for a website I'm working on but the way I have built it, when I speed my mouse over the container div, the animation still happens. How do I get this to recognize that the mouse isn't actually hovering?
The HTML code is:
<div id="badge">
<div id="slogan">
<p>We sell for less!</p>
</div>
<div id="icon"></div>
<div id="name"></div>
<div id="TMhold">
<div id="TM"></div>
</div>
</div>
and this is the jQuery I'm using:
$("#badge").hover(
function() {
$(this).stop(true,true).animate({width: "250px"}, 760, "easeOutQuart");
setTimeout(function() {
$("#TM").stop(true,true).animate({top: "0"}, 500, "easeOutQuart");
}, 500 );
setTimeout(function(pee) {
$('#badge p').stop(true,true).animate({opacity: .99}, 760, "easeOutQuart");
}, 800 );
},
function() {
clearTimeout(pee);
$('#badge p').stop(true,true).animate({opacity: 0}, 120, "easeOutQuart");
setTimeout(function() {
$('#badge').stop(true,true).animate({width: "90px"}, 900, "easeOutQuart");
$("#TM").stop(true,true).animate({ top: "-13px"}, 500, "easeOutQuart");
}, 300 );
}
);
I've read about the clearTimeout function but I'm not sure if that applies to this as my solution.
Thanks so much for any help or clarification!