\$\begingroup\$
\$\endgroup\$
1
I'm kinda worried that the way I did my animation intro is a bit too heavy and is not optimized. Please review and let me know your thoughts.
$(document).ready(function() {
introIconFirst();
function introIconFirst() {
$('h2.ribbon').css({
'marginTop': '+30px',
'opacity': '0'
}).animate({
marginTop: '0',
opacity: '1'
}, 1500, 'easeOutElastic', introIconSecond());
}
function introIconSecond() {
$('#ico_website').rotate('0deg').css({
'top': '+900px',
'opacity': '0'
}).animate({
top: '50px',
opacity: '1'
}, {
queue: false,
duration: 1100,
easing: 'easeOutElastic'
}).animate({
rotate: '-30deg'
}, 1000, 'easeOutElastic', introIconThird());
}
function introIconThird() {
$('#ico_rails').css({
'top': '+900px',
'opacity': '0'
}).delay(300).animate({
top: '145px',
opacity: '1'
}, 1400, 'easeOutElastic', introIconFourth());
}
function introIconFourth() {
$('#ico_plane').css({
'left': '255px',
'top': '90px',
'opacity': '0'
}).delay(800).animate({
top: '18px',
left: '299px',
opacity: '1'
}, 600, 'linear');
}
});
dfhwze
14.1k3 gold badges40 silver badges101 bronze badges
-
\$\begingroup\$ @JoshSmith Thanks. I didn't know it before. Will do for future post. \$\endgroup\$Pennf0lio– Pennf0lio2012年01月01日 09:30:01 +00:00Commented Jan 1, 2012 at 9:30
2 Answers 2
\$\begingroup\$
\$\endgroup\$
1
Looks good, though I prefer to keep the $(document).ready() as clean as possible, by only making calls and not definitions. Makes DOM management a bit easier.
answered Jan 1, 2012 at 0:16
KenKen
-
\$\begingroup\$ No problem, I tend to be a bit too obsessive over things like that. Often times my doc readys' don't consist of more than a few lines. \$\endgroup\$Ken– Ken2012年01月01日 11:09:38 +00:00Commented Jan 1, 2012 at 11:09
\$\begingroup\$
\$\endgroup\$
0
Why the hell you need to declare your functions inside $(document).ready()? :)
answered Jan 1, 2012 at 0:31
Mr. BeatMastaMr. BeatMasta
lang-html