就是背景图片会左右晃动,有点电影的感觉,请问是flash做的还是js写出来的,如果碰巧有会的或者收藏的能不能晒一下~~
------解决方案--------------------
通过js控制background-position样式吗?
------解决方案--------------------
- HTML code
<html>
<head>
<title></title>
<style>
.bg1 {
width:300px;
height:300px;
background-image:url('a.jpg');
background-position-x:-100px;
background-position-y:0px;
}
.bg2 {
width:300px;
height:300px;
background-image:url('a.jpg');
background-position-x:-140px;
background-position-y:0px;
}
</style>
<script>
var index = 0;
function f_onload(){
var vv = setInterval("next()",100);
}
function next(){
index ++;
if(index % 2 == 0){
document.getElementById("bg").className = "bg1";
}else{
document.getElementById("bg").className = "bg2";
}
}
</script>
</head>
<body onload="f_onload();">
<div id="bg" class="bg1">
</div>
</body>
</html>