为什么这个jQuery代码不工作? [英] Why doesn't this jquery code work?

查看:88
本文介绍了为什么这个jQuery代码不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的application.js文件中有这个代码,但它似乎不工作:

I have this code in my application.js file, but it doesn't seem to work:

$("#video_div img").click(function() {
   $("div.embed").toggle();
});

这是我的浏览器看到的HTML:

Here's the HTML my browser sees:

<div id="video_div">
<img src="http://i3.ytimg.com/vi/fTWpHknumdg/hqdefault.jpg" style="width: 200px; ">
<div class="embed">
<object width="300" height="194"><param name="wmode" value="opaque"><param name="movie" value="http://www.youtube.com/v/fTWpHknumdg?version=3">
<param name="allowFullScreen" value="true">
<param name="allowscriptaccess" value="always">
<embed src="http://www.youtube.com/v/fTWpHknumdg?version=3" type="application/x-shockwave-flash" width="300" height="194" allowscriptaccess="always" allowfullscreen="true" wmode="opaque">
</object>
</div>
</div>

现在,我隐藏 div.embed $ div.embed {display:none;} 但是click方法不会使元素重新出现...

Right now, I am hiding the div.embed element with div.embed { display: none;} but the click method isn't making the element reappear again...

推荐答案

我的猜测是Flash错误。尝试相同的代码,但这一次,当u点击图像,然后调整浏览器的大小。

my guess is Flash error. try the same code but this time when u click the image then resize browser.

最近我的Firefox和chrome经常不渲染youtube的vdo(vdo只是白色,但在我调整浏览器的窗口大小后它出现。

recently my firefox and chrome oftenly not render youtube's vdo(the vdo just white like nothing load) but after i resize browser's window its appear.

这篇关于为什么这个jQuery代码不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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