Michael Quiles
Michael Quiles

Reputation: 1151

Jquery fade to making hidden images appear

I am trying to add a fading effect to my page, but once I add this code it makes other images I have set to display:none in css reappear.How can I get this to work on the selected divider only?

<div class="tiles">

"image code here"

 <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>

Upvotes: 0

Views: 318

Answers (1)

Blazemonger
Blazemonger

Reputation: 92983

I can't be sure without seeing the rest of your page code, but you might try replacing <div class="tiles"> with <div class="tiles" id="fade_this"> and change $(".tiles img") to $("#fade_this img")

Upvotes: 1

Related Questions