function histroylinepic() { var height = $('.slider_pic_bg').height(); var width = $('#slider_pic').width(); console.log("histroylinepic"); if (height == 0) { height = 126.14; } console.log(height); $('.prevbtnpic').height(height); $('.nextbtnpic').height(height); $('.historylineweb').height(height); $('.rd_01').width(width / 6); } function histroyline() { var slider_picw = parseint($('#slider_pic').width()); var rd_01w = $('.rd_01').width(); var opic = $('#slider_pic').find('ul'); var oimg = opic.find('li'); var olen = oimg.length / 6; var oli = oimg.width(); var prev = $("#prev"); var next = $("#next"); opic.width(rd_01w * $('#slider_pic').find('ul').find('li').length); //计算总长度 var inow = 0; var itimer = null; prev.click(function () { if (inow > 0) { inow--; } clickscroll(); }) next.click(function () { if (inow < olen - 1) { inow++; clickscroll(); } }); function clickscroll() { inow == 0 ? prev.addclass('no_click') : prev.removeclass('no_click'); inow == olen ? next.addclass("no_click") : next.removeclass("no_click"); inow == 0 ? prev.addclass('xt_click') : prev.removeclass('xt_click'); inow == olen ? next.addclass("xt_click") : next.removeclass("xt_click"); if (inow == 0) { opic.animate({ left: inow * slider_picw }) } else { opic.animate({ left: -inow * slider_picw }) } } }