zoukankan      html  css  js  c++  java
  • 简易列表滚动轮播,上下滚动

    // ===========自动滚屏=============
            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()
  • 相关阅读:
    练习题
    练习
    2.15
    数组
    java聊天工具12.4
    11.13(2)
    11.13
    10.30 作业
    10.23
    面向对象
  • 原文地址:https://www.cnblogs.com/azure-zero/p/14836585.html
Copyright © 2011-2022 走看看