How do i change this so that the #animation src only changes if its not already = suit.gif using an if statement can't figure out syntax.
<script type="text/javascript">
$(function() {
$("#nav").click(function() {
$('html,body').animate({
scrollTop: $(document).scrollTop()+600
}, 1000);
$('#animation').attr('src','images/suit.gif');
});
});
</script>
Try this:
$(function() {
$("#nav").click(function() {
$('html,body').animate({
scrollTop: $(document).scrollTop()+600
}, 1000);
if($('#animation').attr('src') != 'images/suit.gif'){
$('#animation').attr('src','images/suit.gif');
}
});
});