javascript - jQuery - Link after .animate -


i'm trying make code follow link after animation has run.

the idea "gnoll" hits button , send link.

this code far:

it has not link inside it.

(also, button color supposed change halfway through "hit" animation. far have failed on one)

$(document).ready(function(){ $('.homebutton').click(function(){ $('.animateme').html('<img src="construct2/images/gnoll_running.gif" />'); $('.animateme').animate({ left: '+=150', }, 800, function() { $('.animateme').html('<img src="construct2/images/gnoll_hit.gif" />'); }); $('.animateme').animate({ left: '+=0', }, 500); $('.animateme').animate({ left: '+=0', }, 500, function() { $('.animateme') .html('<img src="construct2/images/gnoll_resting_smaller.gif" />'); }); }); $('#addonbutton').click(function(){ $('.animateme').html('<img src="construct2/images/gnoll_running.gif" />'); $('.animateme').animate({ left: '+=250', }, 1000, function() { $('.animateme').html('<img src="construct2/images/gnoll_hit.gif" />') }); $('.animateme').animate({ left: '+=0', }, 1000, function() { $('.animateme') .html('<img src="construct2/images/gnoll_resting_smaller.gif" />'); $("#addonbutton").html('<img src="construct2/images/redbutton.png" />'); }); }); }); 

the code base can see. link should triggered 0.5 sec after last

$('.animateme') .html('<img src="construct2/images/gnoll_resting_smaller.gif" />'); 

i have kinda found out myself :) still not perfect, it's ok.

$('a.home').click(function(){ var newlocation = $(this).attr('href'); $('.animateme').html('<img src="construct2/images/gnoll_running.gif" />'); $('.animateme').animate({ left: '+=150', }, 800, function() { $('.animateme').html('<img src="construct2/images/gnoll_hit.gif" />'); }); $('.animateme').animate({ left: '+=0', }, 500); $('.animateme').animate({ left: '+=0', }, 500, function() { $('.animateme') .html('<img src="construct2/images/gnoll_resting_smaller.gif" />'); document.location = newlocation; }); return false; }); 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -