Сообщение от alcotrip
|
Что-то я намудрил, спрайты меняются неравномерно:
|
Так они у тебя вообще не меняются в примере...
Как вариант...
<!DOCTYPE html>
<html>
<head>
<!--
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" type="text/css" href="tmp.css" />
-->
<style type="text/css">
</style>
<script type="text/javascript">
var i=0;
pos = new Array();
pos[0] = "0 0";
pos[1] = "64px 0";
pos[2] = "128px 0";
pos[3] = "192px 0";
pos[4] = "40px 0";
pos[5] = "50px 0";
function over() {
setTimeout(change_pos, 100)
}
function change_pos() {
document.getElementById("about").style.background = 'url("http://javascript.ru/forum/images/smilies/smile.gif") no-repeat '+ pos[i]+' #ccc';
i++ ;
if (i==pos.length) return;
setTimeout(change_pos, 100)
}
</script>
</head>
<body>
<a id="about" onMouseOver="over()" style="width:200px; height:200px; display:block; background: #ccc"></a>
</body>
</html>