用户1079409
2016-12-02 13:40
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset = "utf-8">
<style type="text/css">
* {
margin: 0;
padding: 0;
}
#move {
width: 300px;
height: 170px;
margin: 10px auto;
border: 1px solid #ccc;
}
#move a {
display: inline-block;
width: 58px;
height: 25px;
border: 1px solid #ddd;
border-radius: 3px;
background-color: #fff;
text-align: center;
margin: 10px 17px;
position: relative;
padding-top: 40px;
color: #9c9c9c;
font-size: 12px;
text-decoration: none;
line-height: 25px;
overflow: hidden;
}
#move a i {
position: absolute;
top: 20px;
left: 0;
display: inline-block;
width: 100%;
text-align: center;
opacity: 1;
filter: Alpha(opacity=100);
}
#move img {
/*padding: 3px 0;*/
border: none;
/*z-index:-1*/
}
#move a:hover {
color: #f00;
}
</style>
<script type="text/javascript" src="运动框架.js"></script>
<script type="text/javascript">
window.onload = function(){
var oMove = document.getElementById('move');
var aList = oMove.getElementsByTagName('a');
for (var i = 0; i < aList.length; i++) {
aList[i].onmouseover = function() {
var _this = this.getElementsByTagName('i')[0];
startMove(_this,{top:-25,opacity:0},function(){
_this.style.top = 30+'px';
startMove(_this,{top:20,opacity:100});
});
}
};
}
</script>
</head>
<body>
<div id="move">
<a href="#">
<i><img src="jsimages/food.png"></i>
<p>食物</p>
</a>
<a href="#">
<i><img src="jsimages/game.png"></i>
<p>游戏</p>
</a>
<a href="#">
<i><img src="jsimages/insurance.png"></i>
<p>保险</p>
</a>
<a href="#">
<i><img src="jsimages/lottery.png"></i>
<p>彩票</p>
</a>
<a href="#">
<i><img src="jsimages/movie.png"></i>
<p>电影</p>
</a>
<a href="#">
<i><img src="jsimages/travel.png"></i>
<p>旅游</p>
</a>
</div>
</body>
</html>
我也出现的这个问题。调js文件,格式是对的
<script type="text/javascript" src="运动框架.js"></script>
<script type="text/javascript">
调js文件,格式不对。应该是:<script src="js/move.js"></script>
<script>写窗口加载的内容</script>
JS动画效果
113925 学习 · 1443 问题
相似问题