This function that captures the movement of the mouse does not work, what is wrong with it to correct?
<script>
$(document).bind("mouseleave", function(e) {
if (e.pageY - $(window).scrollTop() <= 1) {
alert('Tem certeza que quer fechar a aba? :(');
}
});
</script>