A solution to make the bottom nav in the video player disappear after 3 seconds



  • <iframe id="video-player">
    <!DOCTYPE html>
    <html>
        <head>
        </head>
        <body>
            <div id="videoPlayer">
    		<div id="bottomBar">
    		</div>
            </div>
    	<script>
    		var bottomBar = document.getElementById("bottombar");
    		var videoPlayer = document.getElementById("videoPlayer");
    		videoPlayer.addEventListener("mousemove", function(event) {
    			presentBottemBar(event);
    		});
    		function timer(){
    			var stop = false;
    			var d = new Date();
    			d = d.getSeconds();
    			var fd = d + 3;
    			if (!(fd < 59)) {
    				fd = fd - 59;
    			}
    			while (stop == false){
    				if (d >= fd){
    					bottomBar.style.display = "none";
    					stop = true;
    				} 
    				d = new Date();
    				d = d.getSeconds();
    			}
    		}
    		function presentBottemBar(e) {
    			bottembar.style.display = "block";
    			timer();
    		}
    	</script>
        </body>
    </html>
    </iframe>
    

    Legal notice: The above code has no license.
    But if you do use it I'd ask you for the favor to just put the following in your source:

     <!-- #funimation's the best -- CodeIdiot/Alex Angel --> 
    

    Edit: fixed the bug

    var d = new Date(seconds)
    

    to

    var d = new Date();
    d = d.getSeconds();
    

    and changed the timer value from 2.5 seconds to 3.


Log in to reply