I have a slideshow playing that scrolls a div to reveal the next photo in the slideshow. I also have a function set up that hides the photo description when the mouse is inactive, but shows the description when the mouse moves.
In Firefox, there is no problem, the div scrolls to new photos and no mousemove
event is fired. However, in Webkit with the mouse on the window, but inactive, two-three mousemove
events are fired every time the div scrolls to a new photo.
Here's the website for you to have a look. Navigate to the portfolio page in a webkit browser (with a console open I suppose) and that footer should stay hidden while the photos cycle through. /
I have a slideshow playing that scrolls a div to reveal the next photo in the slideshow. I also have a function set up that hides the photo description when the mouse is inactive, but shows the description when the mouse moves.
In Firefox, there is no problem, the div scrolls to new photos and no mousemove
event is fired. However, in Webkit with the mouse on the window, but inactive, two-three mousemove
events are fired every time the div scrolls to a new photo.
Here's the website for you to have a look. Navigate to the portfolio page in a webkit browser (with a console open I suppose) and that footer should stay hidden while the photos cycle through. http://96.0.13.132/
Share Improve this question edited Feb 18, 2021 at 13:46 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Jan 6, 2012 at 17:18 curiousercuriouser 9802 gold badges12 silver badges23 bronze badges 1- For future reference, you should post the website first so your question doesn't get votes to close in the mean time. – Devin Burke Commented Jan 6, 2012 at 17:20
1 Answer
Reset to default 13Yes, webkit browsers do that, and i think every browser should. Because the cursor IS in a different position after the scrolling, and that could avoid me a lot of problems as a developer.
Anyway, if you want to avoid its consequences in your script, just log the latest clientX and clientY position and check if those have changed since the last "mousemove"; something like this:
window.addEventListener("mousemove",function(e){
if(window.lastX !== e.clientX || window.lastY !== e.clientY){
// Code when the (physical) mouse actually moves
}
window.lastX = e.clientX
window.lastY = e.clientY
})