Jump to content

Inactive jquery trigger


dpiearcy

Recommended Posts

Perhaps someone can help me here.  I'm not the best at javascript.  

Basically, I want to hide 2 divs on load then unhide the same 2 divs after inactivity of 5 seconds (for testing.... who wants to wait 1 minute?).

 

This is the code I'm using.  The part I have commented out makes it active again.  Right now, div's are hidden as they should be.  Then after 5 seconds they reveal.  But my video just flashes on (in the #video div of course) then goes off.  If I then make it active then inactive again, the video plays as it should.  

 

Here's the code:

$(document).ready(function() {
  $('#video').hide();
  $('#buttons').hide();
});
 var activityTimeout = setTimeout(inActive, 5000);
    
    function resetActive(){
		$('#video').hide();
  		$('#buttons').hide();
        clearTimeout(activityTimeout);
        activityTimeout = setTimeout(inActive, 5000);
    }
    
    function inActive(){
		$('#video').show();
		$('#buttons').show();
	var myPlayer = _V_("example_video_1"); //this is to play the video in videojs for html5
    }
    
    //$(document).bind('mousemove', function(){resetActive()});
	</script> 

Thanks in advance.

Edited by dpiearcy
Link to comment
Share on other sites

And for the record... I also tried hiding the div's with CSS then showing them with java.  So display: none; for each div, removing that top part of the java and then just showing them when inactive.  Same result.  Video shows briefly but the second time through it stays on.  

 

Thoughts?

Edited by dpiearcy
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.