复制代码 代码如下:
/** Event handler for mouse wheel event.
         *鼠标滚动事件
         */ 
        var wheel = function(event) { 
            var delta = 0; 
            if (!event) /* For IE. */ 
                event = window.event; 
            if (event.wheelDelta) { /* IE/Opera. */ 
                delta = event.wheelDelta / 120; 
            } else if (event.detail) { 
                /** Mozilla case. */ 
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */ 
                delta = -event.detail / 3; 
            } 
            /** If delta is nonzero, handle it.
             * Basically, delta is now positive if wheel was scrolled up,
             * and negative, if wheel was scrolled down.
             */ 
            if (delta) 
                handle(delta); 
            /** Prevent default actions caused by mouse wheel.
             * That might be ugly, but we handle scrolls somehow
             * anyway, so don't bother here..
             */ 
            if (event.preventDefault) 
                event.preventDefault(); 
            event.returnValue = false; 
        } 

        /** Initialization code. 
         * If you use your own event management code, change it as required.
         */ 
        if (window.addEventListener) { 
            /** DOMMouseScroll is for mozilla. */ 
            window.addEventListener('DOMMouseScroll', wheel, false); 
        } 
        /** IE/Opera. */ 
        window.onmousewheel = document.onmousewheel = wheel; 

        /** This is high-level function.
         * It must react to delta being more/less than zero.
         */ 
        var handle = function(delta) { 
            var random_num = Math.floor((Math.random() * 100) + 50); 
            if (delta < 0) { 
                // alert("鼠标滑轮向下滚动:" + delta + "次!"); // 1 
                $("btn_next_pic").onclick(random_num); 
                return; 
            } else { 
                // alert("鼠标滑轮向上滚动:" + delta + "次!"); // -1 
                $("btn_last_pic").onclick(random_num); 
                return; 
            } 
        } 
标签:
js,鼠标滑轮滚动

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。