@
sherlocktheplant 改变 URL ?有没有通过改变 css 来实现的方法?
这是我当前的代码:
```
<ul class="photo" id="photo">
<li><img src="imgs/5.jpg" alt=""></li>
<li><img src="imgs/1.jpg" alt=""></li>
<li><img src="imgs/2.jpg" alt=""></li>
<li><img src="imgs/3.jpg" alt=""></li>
<li><img src="imgs/4.jpg" alt=""></li>
<li><img src="imgs/5.jpg" alt=""></li>
<li><img src="imgs/1.jpg" alt=""></li>
</ul>
<a href="javascript:;" id="prev" class="arrow"><</a>
<a href="javascript:;" id="next" class="arrow">></a>
```
```
var photo = document.querySelector('#photo'),
nextItem = document.querySelector('#next')
index = 1
var translate = function (dom, type, time) {
dom.style.transform = type
dom.style.transitionDuration = time + 's'
}
var animated = function (offset) {
go = 'translate(' + offset*index + 'px, 0)'
if(index == 6) {
index = 1
}
console.log(go)
translate(photo, go, 0.5)
}
var next = function () {
index++
animated(-600)
}
nextItem.onclick = next;
```