Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I have requested some help at stackoverflow.com, but I'm not sure how to make it actually work on my website. I'm aware that stackoverflow isn't exactly for that purpose, but rather to answer one specific question, so I thought I'd ask here.

1. I put the first code (I think it's jQuery) from Shiplu's answer, as seen here at SO. To save time and keep the record in one thread, the code is as follows:

JavaScript
$(function(){
    $("#content").hide();
    window.setTimeout(function(){
        $("#content").show('slow');
        window.setTimeout(function(){
            $("#content").hide();
        },10000);
    }, 5000);
});


I put this code in the following location in my header.php file, right before my
HTML
</head>
tag, and with the
PHP
<?php wp_enqueue_script('jquery'); ?>
string before it to let it know I'm using jquery. And so it looks like this:
	<?php wp_enqueue_script('jquery'); ?>
	<script type="text/javascript">
	$(function(){
    $("#intro").hide();
    window.setTimeout(function(){
        $("#intro").show('slow');
        window.setTimeout(function(){
            $("#intro").hide();
        },10000);
    }, 5000);
});
	</script>


Then in my index.php file, I wrapped the following html5 video within this div tag to look like this:

HTML
<div id="intro">
<video width="672" height="384" controls="controls" autoplay="autoplay"><source src="files/dcgreeting-cleansound.m4v" type="video/mp4" /></video>
</div>


Now of course, this isn't working (yet).

By the way, my goal is to have this video content "toggle" in automatically after a couple of seconds, and then toggle back out after the video finishes playing. Now, ideally I'd like to have a "slide down" effect, but I'll worry about that later (unless this code does that already!).

Thank you. :)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900