如果您查看您看到alert('hey');
的这段脚本,则会在文档头部附加五次。它不会引起任何问题,但我想知道如何让它只发生一次。
$('#logo').fadeIn(2000, function() {
$(this).animate({ top: "-=20px" },{
duration: 1000,
specialEasing: {top: 'easeOutQuad', left: 'easeInQuad'},
complete: function () {
$(this).animate({ top: "63px" },{
duration: 1000,
specialEasing: {top: 'easeOutQuad', left: 'easeInQuad'},
complete: function () {
}
});
$('.home,.about,.investments,.media,.contact').animate({ top: "+=106px" },{
duration: 2000,
specialEasing: {top: 'easeOutQuad', left: 'easeOutQuad'},
complete: function () {
$('#ballTarp').remove();
$("head").append( '<link href="css/hoverStates.css" rel="stylesheet" type="text/css">' );
alert('hey');
$('#ball').removeClass('home').addClass('activeHome');
$('.activeTitle').fadeIn("fast");
$('.dropShadow').fadeIn(7000);
$('footer').fadeIn("fast");
$('.title').fadeIn("slow");
$('.login').fadeIn(3000);
}
});
}
});