Js語言如下 不知道為什么沒有動(dòng)畫效果
window.onload = function(){
var share = document.getElementById('share'),
content = document.getElementById('content');
share.onmouseover = function(){
share.style.backgroundColor = '#FF0';
shareFun();
};
}
var timer = null;
function shareFun (){
var share = document.getElementById('share'),
content = document.getElementById('content');
// clearInterval(timer);
timer = setInterval(function(){
content.style.left = (content.offsetLeft+10)+'px';?
console.log(content.offsetLeft);
},30)
}
2017-07-19
感覺你沒有明確自己要做什么
share.style.backgroundColor = '#FF0'這句的代碼書寫格式好像不是這樣的吧 ?記不太清了
1樓的說的也沒錯(cuò) ?那的確有問題
2017-07-16
content.style.left = (content.offsetLeft+10)+'px'; ? ?這句有問題,不用帶括號吧?