Home > Web Front-end > JS Tutorial > Ideas for using mouse wheel to control horizontal movement of web pages_javascript skills

Ideas for using mouse wheel to control horizontal movement of web pages_javascript skills

WBOY
Release: 2016-05-16 17:39:37
Original
1415 people have browsed it
Copy code The code is as follows:




$('body').mousewheel(function(event, delta) {
var left=$(window). scrollLeft();
$(window). scrollLeft(left-(delta * 100))
event.preventDefault();
})

jquery code to implement horizontal scrolling of web pages requires mousewheel.js. Simply put, it is to set the scrollLeft value of the window. The window must not be the body, otherwise there will be problems with scrolling. Very puzzled. The bound event mousewhell must also be on the body, which is not supported in IE8 or lower windows.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template