function mouseWheel(e){
// cross-browser wheel delta
var e = window.event || e; // old IE support
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
var deltaNum = null;
if(delta > 0) {
deltaNum = 1.1;
} else {
deltaNum = 0.9;
}
//图片的大小范围:宽度、高度范围设置在50-1500个像素之间
if(Math.max(20, Math.min(1600, headImg.width * deltaNum)) < 50 && Math.max(20, Math.min(1600, headImg.height * deltaNum)) < 50) {
alert("您已缩小到最小!")
return;
}
if(Math.max(20, Math.min(1600, headImg.width * deltaNum)) > 1500 || Math.max(20, Math.min(1600, headImg.height * deltaNum)) > 1500) {
alert("您已放大到最大!")
return;
}
headImg.style.width = Math.max(20, Math.min(1600, headImg.width * deltaNum)) + "px";
headImg.style.height = Math.max(20, Math.min(1600, headImg.height * deltaNum)) + "px";
var img_width = headImg.style.width;
var img_height = headImg.style.height;
img_width = parseInt(img_width) / 2;
// cross-browser wheel delta
var e = window.event || e; // old IE support
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
var deltaNum = null;
if(delta > 0) {
deltaNum = 1.1;
} else {
deltaNum = 0.9;
}
//图片的大小范围:宽度、高度范围设置在50-1500个像素之间
if(Math.max(20, Math.min(1600, headImg.width * deltaNum)) < 50 && Math.max(20, Math.min(1600, headImg.height * deltaNum)) < 50) {
alert("您已缩小到最小!")
return;
}
if(Math.max(20, Math.min(1600, headImg.width * deltaNum)) > 1500 || Math.max(20, Math.min(1600, headImg.height * deltaNum)) > 1500) {
alert("您已放大到最大!")
return;
}
headImg.style.width = Math.max(20, Math.min(1600, headImg.width * deltaNum)) + "px";
headImg.style.height = Math.max(20, Math.min(1600, headImg.height * deltaNum)) + "px";
var img_width = headImg.style.width;
var img_height = headImg.style.height;
img_width = parseInt(img_width) / 2;
img_height = parseInt(img_height) / 2;
}
//兼容火狐滚轮事件;
if(navigator.userAgent.indexOf("Firefox") != -1) {
//FF
ImgObjFF[0].addEventListener("DOMMouseScroll",this.MouseWheelHandler, false);
} else {
//非FF
var headImg = $("#headImg", this.$el);
headImg.on("mousewheel", this.MouseWheelHandler);
}