web前端|js教程
js,鼠标滑轮滚动
web前端-js教程
手机在线flash游戏下载网站源码,ubuntu安装到电脑,tomcat启动起响应慢,爬虫电影现状,php商城支付,流星花园电视剧186seolzw
/** 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 bother here..
*/
if (event.preventDefault)
event.preventDefault();
event.returnValue = false;
}
卡密社区源码,ubuntu老毛桃‘’,sts中tomcat的vm,自制垂直爬虫,php 操作两个数据库,闽清企业seo销售价格lzw
/** 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;
iapp源码分享网站,vscode配置编译器,ubuntu 安装dtc,tomcat项目工程名,爬虫软件 教程,php程序编码,芝罘区seo优化关键词,免费模版网站源文件,discuz免费CG模板lzw
/** 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鼠标滑轮滚动事件绑定的简单实例(兼容主流浏览器)【javascript】》对你有帮助,请点赞、收藏,并留下你的观点哦!