Not sure what this is an answer too (appear as a new subject), but:

$("img:not(this)")

You have 'this' as a string in there. That's saying "give me all
images which are not a 'this' element". Should be this:

$("img").not(this) //passing the actual DOM element to not()

I prefer to code it this way:

$(function(){
  $('img').bind('click',function(){
     if ( $(this).css('opacity') < 1 )
      $(this)
       .stop().fadeTo('slow',1)
       .siblings('img').stop().fadeTo('slow',0.3);
 });
});

The stop() avoids queuing of animations and makes it more responsive.

cheers,
- ricardo

On Mar 2, 1:37 am, Sean O <seanodot...@yahoo.com> wrote:
> This was a fun one to play with.
> I think this is the effect you're after...
>
> Demo:http://jsbin.com/iwile
> Source:http://jsbin.com/iwile/edit
>
> It's pretty concise & self-explanatory, but if you have any questions, just
> reply.
>
> SEAN Ohttp://www.sean-o.comhttp://twitter.com/seanodotcom
>
>
>
> ixxalnxxi wrote:
>
> > I'm trying to set up a gallery on my own (similar to galleria) so I can
> > get my hands dirty with jquery.
>
> > I have a set of images that either have the class "inactive" or "active"
> > attached to them. When I leave all my images with the "inactive" class by
> > default, everything works fine but it looks terrible because the image div
> > is empty and all thumbnails have .33 opacity.
>
> > Now, when I set an image to "active", it correctly shows up with an 100
> > opacity thumbnail and a filled in image div once i click on another
> > thumbnail then move back to the thumbnail that was once by default active,
> > it doesn't function correct.
>
> > html,
>
> >    <td>
> >                     images/01_nintendoDSa.gif
> >    </td>
>
> >    <td>
> >                     images/02_nintendoDSb.gif
> >    </td>
>
> >    <td>
> >                     images/03_colourkeys.gif
> >    </td>
>
> > Then the jquery is as follows,
>
> >            $("img.inactive").click(function()
> >            {
> >                    var image = $("img.active");
> >                    if(image != $(this))
> >                    {
> >                            image.removeClass("active");
> >                            image.addClass("inactive");
> >                            image.fadeTo("slow", 0.33);
> >                            $(this).removeClass("inactive");
> >                            $(this).addClass("active");
> >                            $(this).fadeTo("slow", 100);
> >                    }
> >            });
>
> > Any suggestions?
>
> --
> View this message in 
> context:http://www.nabble.com/Newbie-needs-Help-with-jquery-logic-tp22257353s...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to