JS:jQuery选择器有问题,没有线索

时间:2013-05-30 19:37:18

标签: jquery html object selector inheritance

我质疑如何通过jQuery选择特定对象。 以下情况:

<figure class="box col1">
    <img class="fade" src="first.jpg" style="background-image: url(second.jpg)" />
    <figcaption>
      <div class="cenfig">
         <p>
          <strong>Headline</strong>
          <em>Subheadline</em>
        </p>
    </div>
</figcaption>

文件中有几个数字。我想在图中选择img并在其上运行脚本。

问题:

是否可以在图上使用鼠标悬停仅在鼠标内部的img上运行一个函数?

选中此项以了解我的问题:http://jsfiddle.net/NuL7A/1

谢谢!

1 个答案:

答案 0 :(得分:0)

像这样

  $("figure img.fade").mouseover(function(){
    //...
    });