Original: Thought by <a href = "#" >
Ex-array in a mobile project, by <a href = "#" > Bind the Click event to submit a form, because the form information is more sensitive, so the use of post synchronous submission method, originally to also have nothing. Then the evil PM said "you this button, to be fixed at the bottom of the better", and then through the position:fixed fixed to the bottom. So, the problem, under iOS, the virtual keyboard is floating on the top of the page, the result is that when the keyboard is closed, floating at the bottom of the button is not the lowest, and ran to the middle, (under extreme conditions may also block the input box can not be entered), and as the screen scrolling and scrolling, ( Performance similar to absolute), the Big Apple is also really pit a back.
What do we do? Two scenarios, a dynamic calculation of the location when scrolling, real-time monitoring location must be to consume performance, and second, because the virtual keyboard can not be monitored to open or close, so only by the form element binding focus and Blur events to change the button position to achieve the desired effect. So Balabala finished again.
After the completion of the test, and then found that when the input element is in the focus state, click the submit button, invalid!!! I'll point it out.
The reason is because the Blur event prevents the Click event from executing ...
OK, I'll keep changing.
The Blur event prevents the Click event from executing, but does not block the touch event, and then recalls changing the click to tap. That's all. There's no need to click twice.
It's done, I'm proud to laugh, I'm so smart.
Balabala on the line.
An on-line discovery cannot be submitted ... There is a certain probability that the request was canceled ...
A variety of Google did not find out why, the problem is where? Click is no problem, change the tap to have a problem, and then check the touch event execution order, roughly like this
So I test MouseUp is good, touchend is also problematic, tap is also problematic, and when I use the Tap event, handler processing time delay 100ms again $ (' *form '). Submit () can also be submitted normally. It turned out to be the timing of the submit.
Continue all kinds of debug catch bugs, history left pits Ah,,
Finally to <a href = "#" >, when the button click event execution, before the request hash execution submit, the request has not returned, due to change the hash, the synchronous submit was cancel,, and for various reasons before the implementation of the Submit, The hash has changed so that it can be submitted successfully,
Thus, the <a href = "#" > Changed to <a href = "javascript:void (0)" > finally finished.
Thought caused by <a href = "#" >