You can do it like this:
var ultimoMovimento = new Date();
var janela = $('#janela');
$(window).on('mousemove', function () {
    ultimoMovimento = new Date();
    janela.hide();
});
var verificar = setInterval(function () {
    var agora = new Date();
    var diferenca = (agora.getTime() - ultimoMovimento.getTime()) / 1000;
    if (diferenca > 10) janela.show();
}, 3000);
My idea is:
- record the time (in milliseconds) when the page loads, and each time the mouse has movement.
 
- check every 3 seconds if the difference between the time at that time and the time recorded before is greater than 10 seconds.
 
- shows the window when the idle time is more than 10 seconds
 
- hides the window when the mouse moves
 
Another variant is to have an auxiliary function that (re)starts a countdown when the mouse moves.
function esperar() {
    janela.hide();
    var limpar;
    clearInterval(limpar);
    limpar = setTimeout(function () {
        janela.show();
    }, 10000); // 10 segundos, 10 000 milisegundos
}
var janela = $('#janela');
$(window).on('mousemove', esperar);
							
							
						 
@brasofilo does not like Pt_pt :)
– Sergio
OMG, in pt_PT the register does not have this R? Sorry... It was strange to me, the same typographical error 2x, lesson learned :)
– brasofilo
@brasofilo happens :) . The other day I caught to find out what were "plicas".
– Bacco
@Bacco, you complicate, you explain?
– brasofilo
@Brasofilo :) is not bad, so I learned how to say in Pt_br
– Sergio
@brasofilo, at the time I read the title I didn’t understand "plica" none: http://answall.com/questions/13027/problema-plicas-e-if-php
– Bacco
@Sergio, I think it’s
lingua_PAIS:P I love this co-existence in SOPT, every hour learning a new variant.– brasofilo