Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-Language" content="zh-CN"/>
<title></title>
<meta name="Keywords" content="" />
<meta name="Description" content=""/>
<link type="text/css" href="" rel="stylesheet" />
<script type='text/javascript'>
function JumpObj(elem, range, startFunc, endFunc) {
var curMax = range = range || 6;
startFunc = startFunc || function(){};
endFunc = endFunc || function(){};
var drct = 0;
var step = 1;
init();
function init() { elem.style.position = 'relative';active() }
function active() { elem.onmouseover = function(e) {if(!drct)jump()} }
function deactive() { elem.onmouseover = null }
function jump() {
var t = parseInt(elem.style.top);
if (!drct) motionStart();
else {
var nextTop = t - step * drct;
if (nextTop >= -curMax && nextTop <= 0) elem.style.top = nextTop + 'px';
else if(nextTop < -curMax) drct = -1;
else {
var nextMax = curMax / 2;
if (nextMax < 1) {motionOver();return;}
curMax = nextMax;
drct = 1;
}
}
setTimeout(function(){jump()}, 200 / (curMax+3) + drct * 3);
}
function motionStart() {
startFunc.apply(this);
elem.style.top='0';
drct = 1;
}
function motionOver() {
endFunc.apply(this);
curMax = range;
drct = 0;
elem.style.top = '0';
}
this.jump = jump;
this.active = active;
this.deactive = deactive;
}
window.onload = function(){
var obj = document.getElementById("img");
new JumpObj(obj);
}
</script>
</head>
<body>
<ul class='cls'>
<li style='border:1px solid #f00;width:200px;'>
<p class="img" id='img' style="position: relative; top: 0pt;"><a target="_blank" href="/item/2934686930135ece55641001">
<img height="150" width="150" style="background: transparent url(http://img.mall.baidu.com/cccccc/sabpic/item/c2f2d5921952a4aa8de26495.jpg) no-repeat scroll center center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" src="http://st.youa.baidu.com/resource/images/mall/blank.gif"/>
</a></p>
<p class="title"><a title="21世纪全国高校公共课规划教材——新视野大学语文" target="_blank" href="/item/2934686930135ece55641001">21世纪全国高校公共课规划教材——新视野大学语文</a></p>
<p class="price">有啊价:23.40</p>
</li>
</ul>
</body>
</html>