Я не знаю javascript. Я должен сделать некоторые изменения. Я хочу знать, что делает код ниже
$(window).load(function(){
setTimeout(function(){
$("#gmbox div").animate({'top':60},1500,"easeOutElastic");
},1500);
});
function trackLink(link, category, action) {
try {
_gaq.push(['_trackEvent', 'tracklink' ,'click',link.href ]);
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){}
}
$('[rel="outbound"]').click(function(e){
try {
_gaq.push(['_trackEvent','outbound','click',this.href]);
}catch(err){}
});
});
Вот ваш код с комментариями, добавленными для описания того, что происходит
// wait for the document to finish loading then...
$(window).load(function(){
// wait a while and then...
setTimeout(function(){
// animate out a the div element whose id is 'gmbox' (look up the jquery animate API to understaind the specifics)
$("#gmbox div").animate({'top':60},1500,"easeOutElastic");
},1500); // how long to wait (1.5 seconds)
});
// this function isn't actually called anywhere in the code you provided but it could be called from elsewhere
function trackLink(link, category, action) {
try {
// tell google analytics that the user clicked on a link
_gaq.push(['_trackEvent', 'tracklink' ,'click',link.href ]);
// wait 0.1 seconds then change the url in the address bar
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){} // don't worry if this code caused an error
}
// when the user clicks on an element with a rel='outbound' attribute...
$('[rel="outbound"]').click(function(e){
try {
// report this to google analytics
_gaq.push(['_trackEvent','outbound','click',this.href]);
}catch(err){} // don't worry if this code caused an error
});
});