<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

<style>

  *{margin:0;padding: 0;}

  #img{position: absolute;left:1100px; top:45%;}

</style>

</head>

<body>

  <img src="jiangshi.gif" id="img">

</body>

</html>

<script>

var left = 1100; 

var timer = setInterval(function(){

  left-=2;

  img.style.left = left+"px";

},30)

</script>

posted on 2018-08-16 20:42  薛小白  阅读(142)  评论(1编辑  收藏  举报