monisha monisha - 6 months ago 29
jQuery Question

Thumbnail image should be swapped with the current image on click

I have a codepen link which is quite similar to what I want. The only thing I want is that on click of thumbs image the large image should be replaced with the clicked thumbs image and it should not be present in the thumbs list.In total only 5 images should be present in rotation whereas here there are 6(5+ 1repeated in thumbs). I have tried to tweak the JS but it doesn't work as expected. Can anyone please help. Stuck with this problem since morning. Thanks in advance.


$('#thumbs img').click(function(){

Dij Dij
Answer Source

in the click handler event of #thumbs img, you can first show all the images and then hide current image. to start you can trigger click on first image.

$('#thumbs img').click(function(){
  $('#thumbs img').show();
$('#thumbs img').first().trigger('click');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download