var timeout;
$('#object').live('mouseenter', function() {
timeout = setTimeout(function(){
// code that will execute only if mouse spends more than n seconds
}, 2000);
});
$('#object').live('mouseleave', function() {
clearTimeout(timeout);
});
so for example to change text to "Working" and change color to red, following code is fine
<div id="object">Hover here and wait</div>
<script>
var timeout;
var object = $("#object");
object.live('mouseenter', function() {
timeout = setTimeout(function(){
object.css({'color': 'red', 'font-size': '400%'});
object.html('Working');
}, 2000);
});
object.live('mouseleave', function() {
clearTimeout(timeout);
});
</script>
demo