Javascript control pulley sliding around _ javascript skills

Source: Internet
Author: User
This article mainly introduces the Js control pulley slide between the left and right instances. This article provides the implementation code directly. If you need a friend, you can refer to today to get something. The page is originally horizontal, so there is a horizontal scroll bar at the bottom, and there will be no scroll bar when it is vertical. Now it is required that the mouse pulley should be rolled left and right, which requires js Code to be written. This is a great deal of trouble in the process of writing this code.

The functions supported by ie Firefox chrome are completely different.

Here are some knowledge points to explain
Monitor pulley events
Ie: onmousewheel
Firfox: DOMMouseScroll
Chrome: mousewheel
Ah, it's speechless.
The return values of scrolling are also different.
Firfox returns +-3 with detail
Others return +-120 using wheelDelta
Returns a value to determine the direction of scrolling.

In addition to the Left Movement of the Chrome browser page, the general browser also uses document.doc umentElement. scrollLeft
However, chrome uses document. body. scrollLeft

The Code is as follows:

 Untitled document 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.