私はjqueryが初めてで、ワンクリックでいくつかの機能を実行するナビゲーションリンクのセットを作成しました。ファイルのロードに時間がかかるように思われるため、クリックされたリンクに Web ページが反応するまでに長い時間がかかります。これは、「scrollTo」jquery プラグインがあるためでしょうか? リンク コントロールの 1 つの例を添付しました。すべてのリンクは同じですが、いくつかのバリエーションが変更されています。
問題はコードの形式ですか、それともコード自体の問題ですか?
$(".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
});
});
});