Jquery淡出来制作隐藏的图像

时间:2011-09-13 14:28:46

标签: jquery

我正在尝试为我的页面添加一个淡入淡出的效果,但是一旦我添加了这个代码,它就会生成我设置为显示的其他图像:css中的none再次出现。我怎样才能让它在所选的分隔符上工作?< / p>

<div class="tiles">

“此处的图片代码”

 <script>   
            $(document).ready(function(){

    $(".tiles img").fadeTo("slow", 1.0); // This sets the opacity of the thumbs to fade when the page loads
    $(".tiles img").hover(function(){
    $(this).fadeTo("slow", 0.6); // This should set the opacity on hover
     },function(){
    $(this).fadeTo("slow", 1.0); // This should set the opacity back on mouseout
    });
    });

    </script>

1 个答案:

答案 0 :(得分:1)

如果没有看到您网页代码的其他部分我无法确定,但您可以尝试将<div class="tiles">替换为<div class="tiles" id="fade_this">并将$(".tiles img")更改为$("#fade_this img")