Two problems encountered by iscroll

Source: Internet
Author: User
Tags add time
Click the sliding area button to trigger two click events.

Reference foreveryang321 users from csdn Forum (Source: http://bbs.csdn.net/topics/390571943 ):


I also encountered this problem, and finally solved it by two clicks. (500 is the time difference between two clicks, in MS)
1. Write a FN --> myclick, and then onclick = "myclick ();" call.
Code:

JavaScript code?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 vart1 = null;// Set this to global functionmyclick(){     if(t1 == null){         t1 = newDate().getTime();     }else{                vart2 = newDate().getTime();         if(t2 - t1 < 500){             t1 = t2;             return;         }else{             t1 = t2;         }     }     /* Your own code */ }


2. The above code can also be written in the _ end method of iscroll. js (4.2.5). Note that VaR T1 is global.
3. Add the iscroll. js (4.2.5) location for Foreign Forums

JavaScript code?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 topOffset: 0, checkDOMChanges: false,   // Experimental handleClick: true, preventGhostClick: false// Prevent ghost clicks? Prevent two clicks ghostClickTimeout: 500,   // Timeout for ghost click prevention/** * Prevents any real clicks. * See preventGhostClick portion of _end(). */ _preventRealClick: function(e) {     if(e._fake !== true) {         e.preventDefault();         e.stopPropagation();         e.stopImmediatePropagation();         e.cancel = true;         returnfalse;     } }, _end: function(e) {......ev._fake = true; if(that.options.preventGhostClick) { //preventGhostClick: true,     // prevent ghost real clicks on body     document.body.addEventListener(‘click‘, that._preventRealClick, true);     // until ghost click timeout expires     setTimeout(function() {               document.body.removeEventListener(‘click‘, that._preventRealClick, true);     }, that.options.ghostClickTimeout); } target.dispatchEvent(ev);


I used the 1st method and added the time judgment code to the FN of each click. This is complicated and cannot be done. The project manager will not modify iscroll. JS. It is recommended to add time judgment directly in iscroll. Hope to help you


Adding content to the container causes the lower part of the page to flash.

In the face of pages using iscroll,If the DOM structure of the page changes, you must call the refresh method of the scroll object!

Two problems encountered by iscroll

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.