michaellunsford Posted October 20, 2007 Share Posted October 20, 2007 so, I've made a pretty useful script that's supposed to follow the mouse with a popup div. problem is, I'm using clientY to track the vertical mouse position. It works great at the top, but doesn't take the scroll into account... example: http://68.228.8.85/CutieContest/index.php mouse over the top section of photos -- works great... scroll down a little and you'll see the scroll start to place the div higher on the screen. If you continue to the bottom, the div eventually doesn't even show up at all. nutshell: function resetDivPos(event) { d=document.getElementById("preview_window").style; y=event.clientY; x=event.clientX; d.top = (y + 5) + "px"; d.left = (x + 5 + 450>window.innerWidth? x - 400 - 5 : x + 5) + "px"; } What's missing? Quote Link to comment https://forums.phpfreaks.com/topic/74018-solved-follow-the-mouse/ Share on other sites More sharing options...
michaellunsford Posted October 22, 2007 Author Share Posted October 22, 2007 well, I have it working. the missing feature was scrollTop Quote Link to comment https://forums.phpfreaks.com/topic/74018-solved-follow-the-mouse/#findComment-375549 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.