Hi, 

I'm fairly new to jQuery so bare with me. I've had a search on the forums,
but if its already been answered i apologise....

I'll show the code first...easier to explain

<div class="product">
<div class="display"> images/bedroom.jpg </div><br />
<div class="thumbs"> images/thumbs/bedroom.jpg  images/thumbs/bedroom1.jpg 
images/thumbs/bedroom2.jpg </div>
</div>

<div class="product">
<div class="display"> images/tables.jpg </div><br />
<div class="thumbs"> images/thumbs/tables.jpg  images/thumbs/tables1.jpg 
images/thumbs/tables2.jpg </div>
</div>

Multiple product classes, when you click on one of the thumbnails, the img
in the display class updates....or rather it should. When a thumbnail is
clicked the images in all of the display classes change to the selected
image rather than just the display class in the containing div.

I know its because I need to select display class in the current selected
product but i don't know how...

I've tried variations on the theme of

$(this).parent().parent('.display img').attr('src', val);
$(this).parents.......
etc etc


Below is the current code (where all the images display the same)

$(document).ready(function() {
  $('.thumbs img').click(function() {
        var scr = $(this).attr('src').replace("thumbs/","");
        $('.display img').attr("src", scr);
  });
});

But I'm just stumped. Please help, I hope I've made myself as clear as
possible, if not i apologise



-- 
View this message in context: 
http://www.nabble.com/Set-src-of-image-in-containing-div-of-this-div---tp16287766s27240p16287766.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to