<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title></title>
<style>
.divItem
{
width: 200px;
height: 50px;
text-align: center;
border: 1px solid darkgray;
border-radius: 5px;
cursor: pointer;
}
.active
{
background-color: green;
}
</style>
</head>
<body>
<div class="divItem" id="item1">Item1</div>
<div class="divItem" id="item2">Item2</div>
<div class="divItem" id="item3">Item3</div>
<div class="divItem" id="item4">Item4</div>
</body>
<script type="text/javascript" src ="http://localhost/Script/js/jQuery/jquery-1.11.2.min.js">
</script>
<script type="text/javascript">
var funcHandlers = {};
function intervalHandle(id)
{
delete funcHandlers[id];
$('.divItem').removeClass('active');
$('#' + id).addClass('active');
}
function mouseIn(event)
{
var funcHandler = setTimeout(intervalHandle, 1000, $(this).attr('id'));
funcHandlers[$(this).attr('id')] = funcHandler;
}
function mouseOut(event)
{
$('.divItem').removeClass('active');
clearTimeout(funcHandlers[$(this).attr('id')]);
delete funcHandlers[$(this).attr('id')];
}
$(document).ready(function()
{
$('.divItem').bind('mouseenter', mouseIn);
$('.divItem').bind('mouseleave', mouseOut);
});
</script>
</html>