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 |
var t1 = null ; // Set this to global function myclick(){ if (t1 == null ){ t1 = new Date().getTime(); } else { var t2 = new Date().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 ; return false ; } }, _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