如何一起工作? jQuery + WordPress ... [英] How to make this work together? jQuery + WordPress...

查看:112
本文介绍了如何一起工作? jQuery + WordPress ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我已经在stackoverflow.com上请求了一些帮助,但是我不确定如何使它在我的网站上真正起作用.我知道stackoverflow并非完全出于此目的,而是要回答一个特定的问题,所以我想在这里问.

1.我从Shiplu的答案中放入了第一段代码(我认为它是jQuery),如

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:

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



我将此代码放在header.php文件中的以下位置,就在我的



I put this code in the following location in my header.php file, right before my

</head>

标签,并带有

<?php wp_enqueue_script('jquery'); ?>

之前的字符串,以使其知道我正在使用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>



然后在我的index.php文件中,将以下html5视频包装在该div标签中,如下所示:



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

<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. :)

推荐答案

(函数(){


( " ).hide(); 窗口 .setTimeout(函数(){
("#content").hide(); window.setTimeout(function(){


(" ).show(' 慢'); 窗口 .setTimeout(函数(){
("#content").show('slow'); window.setTimeout(function(){


这篇关于如何一起工作? jQuery + WordPress ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆