In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to use HTML touch event in mobile terminal, the content is detailed and easy to understand, the operation is simple and fast, and it has certain reference value. I believe everyone will gain something after reading this article on how to use HTML touch event in mobile terminal. Let's take a look at it together.
1.touchstart
Trigger when finger touches screen
dom.addEventListener('touchstart',function(e){});startX=e.touches[0].clientX;
The e object returned by the event contains mobile-specific attributes:
tarchTouches: all current touches of the target element
changedTouches: all recently changed touches on the page
touches: all touches on the page
2.touchmove
Triggers continuously as your finger slides across the screen
dom.addEventListener('touchmove',function(e){});
The e object returned by the event contains mobile-specific attributes:
tarchTouches: all current touches of the target element
changedTouches: all recently changed touches on the page
touches: all touches on the page
3.touchend
Trigger when finger leaves screen
dom.addEventListener ('touchend ',funciton(e){});//Touches can't get touch object in touchend,//because touch has ended, changedTouches gets touch object//console.log (e);//endX=e.touches[0]; undefined endX=e.changedTouches [0].clientX;
The e object returned by the event contains mobile-specific attributes:
changedTouches: all recently changed touches on the page
touchcancel: Triggered when the system stops tracking touches. (Not often used)
event notification records changeTouches at the time of the touchend event
4. e.touches[0]
clientX: Touch the X coordinate of the target in the viewport.
clientY: Touch the Y coordinate of the target in the viewport.
pageX: X coordinate of the touch target in the page.
pageY: y coordinate of the touch target in the page.
screenX: Touch the x coordinate of the target on the screen.
screenY: Touch the y coordinate of the target on the screen.
The content of this article on "How to use HTML touch events in mobile" is introduced here. Thank you for reading! I believe everyone has a certain understanding of the knowledge of "how to use HTML touch events in mobile terminal." If you still want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.