1 - you need to initialize the dialog first. Code here
$(document).ready( function() {
$("#dialog").dialog({ autoOpen: false });
$("img").bind("mouseover", function() {
$("#dialog").dialog('open');
});
});
2 - just use a counter
var _counter = 0;
var _seconds = 0;
$("img").hover(function() {
_counter = setInterval(openDialogNow(), 1000);
}, function() {
clearInterval(_counter);
});
function openDialogNow() {
_seconds++;
if(_seconds == 3) {
_seconds = 0;
$("#dialog").dialog('open');
}
}
source
share