我是 jquery 的新手,我创建了一组导航链接,这些链接可以一次单击完成多个功能。加载文件似乎需要很长时间,因此网页对单击的链接做出反应需要很长时间。这可能是因为我有“scrollTo”jquery 插件吗?我附上了一个链接控件的示例,所有链接都是相同的,只是有一些变化。
问题是代码的格式还是代码本身的问题?
$(".releases").click(function(){
$('html, body').stop().animate({ scrollTop: 0 }, 3000, function(){ //returns to top of the page
$("#content").load('content.html #releases'); //loads the content associated with the link
$("#banner").stop().animate({
'background-position-x' : '-700px',
'background-position-y' : '-500px'}, //background image position change
2000, function()
{$.scrollTo("#content", 3000); //returns to the main page content
});
});
});