JQueryでバックグラウンドアニメーションメソッドを使用しようとしていますが、機能しません。これが私が使用しているコードです。
$(".menu_item").mouseenter(function(){$(this).animate({backgroundColor: "#FF8040"}, 'fast');});
$(".menu_item").mouseleave(function(){$(this).animate({backgroundColor: "#999"}, 'fast');});
どんな助けでもありがたいです。
残りはここにあります。
メニューのHTML:
<div id="menu">
<a href="index.html" id="home_menu" class="menu_item">Home</a>
<a href="index.html" class="menu_item">Tutorials</a>
<a href="index.html" class="menu_item">News</a>
</div>
およびスクリプト:
<script type="text/javascript">
$(document).ready(function(){
jQuery().ready(function(){
$(".menu_item").mouseenter(function(){$(this).animate({backgroundColor: "#FF8040"}, 'fast');});
$(".menu_item").mouseleave(function(){$(this).animate({backgroundColor: "#999"}, 'fast');});
var pos = $("#fixed_head").position();
var height = $("#fixed_head").height();
var height2 = $("#menu").height();
var screenHeight = $("body").height();
var newHeight = screenHeight - height - height2;
$("#container").css("top", (pos.top + height));
$("#container").css("height", newHeight);
$("#content").css("height", newHeight);
$(window).resize(function() {
var pos = $("#fixed_head").position();
var height = $("#fixed_head").height();
var height2 = $("#menu").height();
var screenHeight = $("body").height();
var newHeight = screenHeight - height - height2;
$("#container").css("top", (pos.top + height));
$("#container").css("height", newHeight);
$("#content").css("height", newHeight);
});
});
});
</script>
そして頭の中で:
<script type="text/javascript" src="jquery.js"></script>