views:

15

answers:

1

I have an image slider that slides automatically. Because I'm nice, I want to ensure that it doesn't continue to slide when the user has a different window/tab focussed.

What events fire when leaving a tab/window, and which fire when returning?

+1  A: 

When leaving: blur When entering: focus

  • Additionally, the following can happen:
  • click: when the user clicks on the window to get focus
  • mouseover: when the user moves over the window
  • mousedown/mouseup: related to clicking
  • keyup/keydown: Pressing a key (e.g. ctrl + tab)
Lekensteyn
So if I triggered the slider to stop on when window is blurred and start when window is focussed, it should work?
Rich Bradshaw
Yes, just try it :)
Lekensteyn