jquery - Stop click from fading an image when visable -


this prabobly basic jquery stuff can't seem find right code fits needs.

so, im trying set simple image fader. if button clicked, 1 image fades other. problem want stop event happening when image visible. way have set makes image fadeout, fadein though it's faded in. way can keep clicking button multiple times.

is there way can stop happening? if visible unbind click?

any smarter people out there? in advance!

$('#services .servicewrap h3').click(function (event) {      var service = 'service' + $(this).attr("id");      $('#services .servicewrap img').fadetoggle(200, function () {         $('#services .servicewrap img').attr("src", 'img/' + service + '.gif');         $('#services .servicewrap img').fadetoggle(200);     }); });  

inside click event add condition

if($('#services .servicewrap img').is(':visible')){      //do }else{    //do } 

Comments