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 }) } } }