if (element.offsetLeft + element.offsetWidth - currentX < window.innerWidth && element.offsetLeft - currentX > 0 && element.offsetTop - currentY > 0 && element.offsetTop + element.offsetHeight - currentY < innerHeight) { element.style.top = (element.offsetTop - currentY) + “px”; element.style.left = (element.offsetLeft - currentX) + “px”; } TLDR: The window cannot be moved outside of the screen. (this prevents windows from becoming unclosable)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.