var a = 0;var step = 0; $('.recommend .next').click(function () { (a < 3) ? (a ++, step = (a * 1226) + 'px', $('.recommend .recommendList').css('left' , '-' + step)) : 1 ; (a == 3) ? $(this).css({color:'#ccc', border:'1px solid #ccc', cursor:'default'} , $(this).siblings('div.p').css({color:'#000', border:'1px solid #000', cursor:'pointer'})) : 1 ; }); $('.recommend .prev').click(function () { (a > 0) ? (a --, step = (a * 1226) + 'px', $('.recommend .recommendList').css('left' , '-' + step)) : 1 ; (a == 0) ? $(this).css({color:'#ccc', border:'1px solid #ccc', cursor:'default'} , $(this).siblings('div.p').css({color:'#000', border:'1px solid #000', cursor:'pointer'} )) : 1 ; });这两段怎么合成一段?a<3 a>0 a++ a--不会弄。请大神看一下
添加回答
举报
0/150
提交
取消