Notification texts go here Contact Us Buy Now!

Mousemove event not firing on page element or document

Your local code works fine. Grab the event by the document like

$(document).on('mousemove', '.slick-slide', function(){ console.log('mousemove'); });

Check it out in the website.

The problem was that specific chrome tab. I don't know why I was having issues, but refreshing it didn't change anything--but when I loaded the site in an incognito window and a new chrome window it fixed it.

The only thing that was different between the tabs was that the one I was having the issue in had been open for a much longer time (~3-4 hours). I don't know why that would affect anything, but I would love to hear what someone thought if they had any ideas.

Not sure if this answers your specific question, but it might be helpful for others that turn up here.

If you're testing using Chrome dev tools (say) and you have a device profile active, then Chrome will emulate touch interaction and not send mousemove events (as would be the case for a phone/tablet where the browser can't tell when the users finger if it's not touching the screen).

If you change the device type from (eg) "Desktop (touch)" to just "Desktop", you'll keep the desired screen size, but gain back the mouse events.

Most devs experiencing this have their dev console open, and in Chrome this usually changes your input to be in touch mode, where there is no constant cursor as there is on desktops.

Either make your code have different behavior for touch input to get a desired result, or you can add a device type to your dev console session by changing the options shown in the attached screenshot.

enter image description here

This seems to be an issue if you have a responsive mode selected on your Chrome Dev Tools

You can easily resolve it by switching to Desktop like this:

1. Try toggle Device toolbar

Toggle Device toolbar

2. Switch to Desktop mode manually

Add Device Type Select Desktop

I had the same issue, I had used a "mousemove" event listener. When running on the live server it was not recording any mouse events onto the console (I had opened my dev tools). But, I closed my dev tools and hovered over the elements, and then opened the dev tools console and it was recorded.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.