Kjapp og trygg hosting for Wordpress

Hvorfor banker ikke hjertet?

adeneo

Medlem
Funksjonen kjøres før elementene er tilgjengelige.

Enten flytt javascriptet etter elementene, altså rett før </body>, eller gjør

PHP:
$(function() {
    animatethis($('#heart'), 1500);
});
 

adeneo

Medlem
Noe sånt

PHP:
function animatethis(targetElement, speed) {
    targetElement.animate({width: "+=15px"}, speed).promise().done(function() {
        $(this).animate({width: "-=40px"}, speed).promise().done(function() {
            if ( !$(this).width() <= 0 )
                animatethis(targetElement, speed);
        });
    });
}
 
Topp