/** * @description 上一个 */ preHandle(){ let ul_dom=document.querySelector('div.box_ul>ul') if(this.xValue===0){return;} if(this.xValue>-80){ this.xValue=0 }else{ this.xValue+=80 } ul_dom.style.transform='translateX('+this.xValue+'px)' }, /** * @description 下一个 */ nextHandle(){ let div_dom=document.querySelector('div.box_ul') let ul_dom=document.querySelector('div.box_ul>ul') if(div_dom.clientWidth>=ul_dom.clientWidth){ return; } if(div_dom.clientWidth<=(ul_dom.clientWidth+this.xValue)){ if((ul_dom.clientWidth+this.xValue-div_dom.clientWidth)<80){ this.xValue-=ul_dom.clientWidth+this.xValue-div_dom.clientWidth }else{ this.xValue-=80 } }else{ return } ul_dom.style.transform='translateX('+this.xValue+'px)' },
12-17
3000
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交