My JQuery: //script.js
$(document).ready(
function()
{
$(".image").bind('mouseenter',
function()
{
$(this).stop().animate(
{
backgroundColor: "blue"
},
{
queue:false,
duration:300,
easing: "swing"
});
});
$(".image").bind('mouseleave',
function()
{
$(this).stop().animate(
{
backgroundColor: "green"
},
{
queue:false,
duration:300,
easing: "swing"
});
});
});
HTML: //index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet.css"></link>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div class="image"></div>
</body>
</html>
CSS: //stylesheet.css
body
{
background-image: url("background.jpg");
margin:0 auto;
padding:0;
}
.image
{
background-color: green;
width: 100px;
height: 100px;
}
Nothing happens with the div, but if I try it with css() it works! How can I fix this? Everything gets called correctly, even some stuff after animate() (I added an alert() to check lol) so I have no clue why...