This is my code in js:
window.onload = function(){
var bsDiv = document.getElementById("box");
var x, y;
// On mousemove use event.clientX and event.clientY to set the location of the div to the location of the cursor:
window.addEventListener('mousemove', function(event){
x = event.clientX;
y = event.clientY;
if ( typeof x !== 'undefined' ){
bsDiv.style.left = x + "px";
bsDiv.style.top = y + "px";
}
}, false);
}
</script>
i want to add a function that if the cursor is off screen (or at position null?) it makes the element invisible and then make it re-visible on the cursors re entry