dpiearcy Posted April 18, 2013 Share Posted April 18, 2013 (edited) 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 April 18, 2013 by dpiearcy Quote Link to comment https://forums.phpfreaks.com/topic/277090-inactive-jquery-trigger/ Share on other sites More sharing options...
dpiearcy Posted April 18, 2013 Author Share Posted April 18, 2013 (edited) 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 April 18, 2013 by dpiearcy Quote Link to comment https://forums.phpfreaks.com/topic/277090-inactive-jquery-trigger/#findComment-1425512 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.