js滚动事件
<script type="text/javascript">
    var fixedblock = function(instancename) {
        this.instance = document.getElementById(instancename);
        this.initTop = parseInt(this.instance.style.top);
        this.initialize();
    }
    fixedblock.prototype.initialize = function() {
        var inst = this;
        //滚动事件
        var scrollevent = function() {
            var fblock = inst.instance;
            fblock.style.top = inst.initTop + parseInt(document.documentElement.scrollTop || document.body.scrollTop) + "px";
        };
        //重定义窗口大小
        var resizeevent = function() {
            var fblock = inst.instance;
            fblock.style.left = "2px";
        };
        if (document.body.attachEvent) {
            //IE7
            document.body.attachEvent("onscroll", scrollevent);
            //在IE6里
            window.attachEvent("onscroll", scrollevent);
            window.attachEvent("onresize", resizeevent);
        }
        else {
            document.addEventListener("scroll", scrollevent, false);
            window.addEventListener("resize", resizeevent, false);
        }
        scrollevent();
        resizeevent();
    }
//这里开始
    window.fblock = new fixedblock("kf");
这里要说明的是,你的页面上一定要有一个DIV id="kf"
这样就可以实现那个滚动的效果
    </script>
    
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号