日期:2014-05-17  浏览次数:20368 次

js修改css
如题:在ul下有li 里面是图片左右点击、左右滚动的,一次滚全屏6张 问题是:我第一次点击按钮、图片可以滚动6张之后点击就只能滚动一张了 document.getElementById ("goleft").style.left="-1375"; 我怀疑是第一次点击后修改了css使其style.left="-1375" 之后就不再修改css了 我想做的是每次点击都可以修改下这个css使其滚动6张 希望大牛们可以给我点思路或者代码?谢谢了....

------解决方案--------------------
document.getElementById ("goleft").style.left="-1375px"

px不能省
------解决方案--------------------
左移动
function turnLeft() {
var scrollimg = $("#goleft");
if (scrollimg.css("margin-left") != "0px") {
var headli = scrollimg.children().slice(0, 6).clone(); scrollimg.append(headli);
scrollimg.animate({ marginLeft: "-=" + 1375 }, "slow", "swing", function() { scrollimg.css("margin-left", "0px"); for (i = 0; i < 4; i++) { $("#scrollimglist li:last").remove(); } });
}
else { scrollimg.animate({ marginLeft: "-=" + 1375 }, "slow", "swing"); } 
}