When iscroll is used, input and other solutions that cannot input content

Source: Internet
Author: User

Recently, I used iscroll to slide the screen up and down on the mobile platform. It is found that when iscroll is used, input and so on cannot be entered. Add the following content to the iscroll. js file:CodeOK.

 
FunctionAllowformsiniscroll () {[]. Slice. Call (document. queryselectorall ('Input, select, click'). foreach (Function(EL) {El. addeventlistener (('Ontouchstart'InWindow )? 'Touchstart': 'mouseunder ',Function(E) {e. stoppropagation () ;})} document. addeventlistener ('Domainloaded', allowformsiniscroll,False);

The cause is:Iscroll needs to constantly listen to the user's touch operations to make the corresponding effect, so it shields the remaining default events.

the above Code principle is : after the page is loaded, all the 'inputs, select, click the button element and bind the 'touchstart' or 'mousedown 'events in sequence to stop the event Propagation when the event is executed.

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.