javascript - jQuery fadeIn() between if and else -
i want fade between different images loaded when different things happen. created if, else rules , thought can tell jquery fadein()
fade in every new image. it's not working , don't know why. think it's super little code thing can't figure out. hope guys can me!
here code far:
if(count == 1){ $('.star').html('<img src="' + stern1 + '">').delay(1000).fadein('slow'); } else if (count == 2){ $('.star').html('<img src="' + stern2 + '">').delay(1000).fadein('slow'); } else if(count == 3){ $('.star').html('<img src="' + stern3 + '">').delay(1000).fadein('slow'); } else if(count == 4){ $('.star').html('<img src="' + stern4 + '">').delay(1000).fadein('slow'); } else if(count == 5) { $('.star').html('<img src="' + stern5 + '">').delay(1000).fadein('slow'); } else { $('.star').html('<img src="' + stern1 + '">').delay(1000).fadein('slow'); }
your mistakes is:
insert content in html
so displays content always, effort not showing delay , fadein.
please try following:
$('.star').html('<img src="' + stern1 + '">').hide().delay(1000).fadein('slow');
Comments
Post a Comment