项目效果:
实现方法:
<!DECTYPEhtml><html><head><metacharset=‘utf-8’><title>onwheel-testtitle>head><body><divid='out'style='width:500px;height:500px;overflow:auto'><divid='inside'style='width:1000px;height:1000px;background-color:gray;overflow:auto'>div>div><scripttype='application/Javascript'>var outDiv= document.getElementById('out');
outDiv.onwheel=function(event){
event.preventDefault();var step=50;if(event.deltaY<0){this.scrollLeft-= step;}else{this.scrollLeft+= step;}}script>body>html>