Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

jQuery Change Image on click

I have a small jQuery function that swaps images on click.  However, after you start clicking on the thumbnails the main thumbnail, the initial thumbnail starts to show up twice.  You can go here and click on the images on the left to see what I mean.

cohr-dev-ee01 DOT azurewebsites DOT net/lasers/laser/diode-laser-systems-and-fiber-lasers/highlight-d-series

<script>
$(function() {
$('.image-thumb-cont img').click(function() {
var thmb = this;
var src = this.src;
$('.main-image-cont img').fadeOut(400,function(){
thmb.src = this.src;
$(this).fadeIn(400)[0].src = src;
});
});
});

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robert Granlund

ASKER

Perfect.  Thanks.