為什么點(diǎn)擊箭頭,我的圖片沒(méi)有反應(yīng)?js代碼如下:
window.onload =function(){
//1、獲取元素 catch element
var container=document.getElementById('container');
var list=document.getElementById('list');
var buttons=document.getElementById('buttons').getElementsByTagName('span');
var prev=document.getElementById('prev');
var next=document.getElementById('next');
next.onclick=function(){
list.style.left=parseInt(list.style.left)-600+'px';
console.log('yyyy');
}
prev.onclick=function(){
list.style.left=parseInt(list.style.left)+600+'px';
console.log('xxxx');
}
}
2017-07-29
在html文件list標(biāo)簽后加個(gè)style="left:-600px"就可以了
2017-06-03
我試了一下你的代碼,沒(méi)有問(wèn)題呢,可以點(diǎn)擊箭頭向前向后。