LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-01-2019, 03:11 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 9.2
Posts: 1,166

Rep: Reputation: 51
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.

Last edited by rblampain; 10-01-2019 at 03:13 AM.
 
Old 10-01-2019, 05:48 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,144

Rep: Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967Reputation: 3967
Some ideas here:

https://stackoverflow.com/a/10126042

Last edited by dugan; 10-01-2019 at 05:51 PM.
 
2 members found this post helpful.
Old 10-01-2019, 06:02 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,221
Blog Entries: 11

Rep: Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171
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.

Last edited by astrogeek; 10-01-2019 at 06:03 PM. Reason: topy
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ubuntu 16 goes power save mode after few minutes of inactivity taru.tarak Linux - Desktop 5 11-28-2018 01:58 AM
LXer: Automatically Disconnect Idle or Inactive SSH Sessions (After Few Minutes Of Inactivity) LXer Syndicated Linux News 0 07-07-2017 12:50 PM
lock the console after 5 minutes of inactivity. pinga123 Linux - Newbie 13 09-16-2010 02:13 AM
Wireless network goes comatose after fifteen minutes of inactivity. pappy_mcfae Linux - Wireless Networking 4 07-29-2007 04:58 AM
USB Mouse stops responding after some period of inactivity dmartins Linux - Hardware 0 12-06-2005 08:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration