首页 > 其他 > 详细

简易列表滚动轮播,上下滚动

时间:2021-06-01 14:47:04      阅读:29      评论:0      收藏:0      [点我收藏+]
// ===========自动滚屏=============
        function ScrollList(name){
            this.list=document.getElementsByClassName(name)[0]
            this.prize_scroll=null
            var that=this
            this.list.addEventListener(‘mouseenter‘,function(){
                clearInterval(that.prize_scroll)
            })
            this.list.addEventListener(‘mouseleave‘,function(){
                that.init()
            })
        this.init=function(){
                clearInterval(that.prize_scroll)
                that.prize_scroll=setInterval(function(){
                    
                    that.list.scrollTop+=1
                    if(that.list.scrollTop==that.list.scrollHeight-that.list.offsetHeight){
                        
                        that.list.scrollTop=0
                    }
                },100)
            }
            
        }
    var scroll1=new ScrollList(‘tcont‘)//tcont需要overflow:auto
    scroll1.init()

 

简易列表滚动轮播,上下滚动

原文:https://www.cnblogs.com/azure-zero/p/14836585.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!