LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How can I change background image after x minutes of mouse inactivity? (https://www.linuxquestions.org/questions/programming-9/how-can-i-change-background-image-after-x-minutes-of-mouse-inactivity-4175661813/)

rblampain 10-01-2019 03:11 AM

How can I change background image after x minutes of mouse inactivity?
 
I can not find anything on the subject. What I am hoping to do is to replace the HTML/CSS background image after a period of mouse/keyboard inactivity, or replace the whole HTML page. There is a "onmousemove" but nothing like "onmousestill". Maybe I am not "googling" with the right keywords.

Can anyone make a suggestion? CSS or Javascript?

Thank you for your help.

dugan 10-01-2019 05:48 PM

Some ideas here:

https://stackoverflow.com/a/10126042

astrogeek 10-01-2019 06:02 PM

I take the question to mean you want to change a background image in an HTML element in a web page if the mouse is inactive in the browser window, is that right?

If so, how about an implementation using javascript setTimeout() and clearTimeout() functions.

Set a timeout which will change the background by modifying a CSS attribute on the target element, or reload the page. Then use onmousemove() to call clearTimeout() to stop the timeout action, then reset the timeout.


All times are GMT -5. The time now is 05:49 PM.