dmitriymar, на
<div id='foo' style='width: 50px; height: 50px; position: absolute; background: #555555'>
</div>
<script type='text/javascript'>
window.onload = function () {
function delta(progress) {
function d(progress) {
for(var a = 0, b = 1, result; 1; a += b, b /= 2) {
if (progress >= (7 - 4 * a) / 11)
return -Math.pow((11 - 6 * a - 11 * progress) / 4, 2) + Math.pow(b, 2);
}
}
return 1 - d(1 - progress);
}
document.getElementById("foo").onclick = function () {
var E = this;
this.onclick = new Function;
(function (toTop, from, to) {
var start = new Date().getTime(),
callee = arguments.callee;
setTimeout(function () {
var progress = (new Date().getTime() - start) / 1000;
E.style.top = ((to - from) * (toTop ? progress : delta(progress)) + from) + "px";
if (progress < 1)
setTimeout(arguments.callee, 13);
else
callee(!toTop, toTop ? 0 : 180, toTop ? 180 : 0);
}, 13);
})(false, 0, 180);
};
};
</script>
Просто интересно узнать, что опять не так.