<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
无标题文档 <!-- .headbanner { position:absolute; left:44px; top:57px; width:1000px; height:280px; z-index:1; margin:0px; padding:0px; overflow:hidden; } .banner { position:absolute; left:0px; top:0px; height:280px; z-index:1; margin:0px; transition: margin-left 2s; -moz-transition: margin-left 2s; /* Firefox 4 */ -webkit-transition: margin-left 2s; /* Safari 和 Chrome */ -o-transition: margin-left 2s; /* Opera */ } li{ list-style-type:none; float:left; display:block; width:1000px; height:280px; } --> function changeimage(){ document.getElementById("banner").style.marginLeft="-1000px"; }
网页图片的切换做出来了,但是其中过渡有问题,当我点击更换图片的时候并不是平滑的滑过去,而是剩下的地方变成白色,然后2s时间过去后,才会变成第二张图片。