1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to make video only when tab is active

Discussion in 'HTML & JavaScript' started by Mutikasa, Nov 6, 2012.

  1. Mutikasa

    Mutikasa Power Member

    Joined:
    May 23, 2011
    Messages:
    575
    Likes Received:
    212
    Hi,
    I want to make this: video on website which plays only when the tab is active and counter which checks the mouse movements and if 30 sec there's no mouse movement the video stops.
    Basically, I want to force users to watch this video.
    tnx
     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,147
    Use jQuery - track mouse movement and then remove the video from the DOM if it 's not moving.
     
    • Thanks Thanks x 1
  3. berkolish

    berkolish Newbie

    Joined:
    Oct 2, 2012
    Messages:
    21
    Likes Received:
    2
    Yes, this would be pretty easy to do with Jquery or plain Javascript.