so I'm currently making a toplist and I'd like to add a little javascript to it. I've decided to make a background color fade in when a visitor hovers their mouse over a name.
But the problem is, it keeps flashing in and out, which is quite annoying! - Here is my code:
<script type="text/javascript">
var isOn = false;
if(isOn == false)
{
$('#rank<?= $info['ID']; ?>').hover(function(){
isOn = true;
$('#rank<?= $info['ID']; ?>').animate({
backgroundColor: '#FF0000'
});
});
}
$('#rank<?= $info['ID']; ?>').mouseout(function(){
isOn = false;
$('#rank<?= $info['ID']; ?>').animate({
backgroundColor: 'white'
});
});
</script>
I want to fade in to a color when a visitor hovers over the area, and change back to a different color when a visitor hovers out of the area.
Thank you.