The problem of cursor misalignment in the input position:fixed popup box in IOS11

Source: Internet
Author: User

The background of the problem arises:

The problem of cursor misalignment in the input position:fixed popup box in IOS11


Solution Solutions

First, the design of interaction is best not to let the pop-up window appear in the input box;

Second, the front-end processing of this compatibility scenario ideas:

1, judging mobile phone models:Android or iOS ios11 or iOS other

/*ver is iOS version, if Android ver is not an array */
var
ver = (navigator.appversion). Match (/os (\d+) _ (\d+) _? ( \d+)?/); if (Array.isarray (ver)) { = parseint (ver[1);}

2. Determine where the popup box appears

A, click on the event will contain input pop-up box position:fixed changed to position:absolute

b, calculate the position of the pop-up box, if Clickbutton on the top half of the screen, keep the popover on top of the screen, if the Clickbutton is below half the screen, keep the pop-up box in the bottom of the screen

/*
#get_award  's Clickbutton.
. Tan_box is a popup box
*/
$("#get_award"). Click (function () {varTop = $ ( This). Position (). Top;/*Click the opposite of the button from the top of the screen*/    varScrollTop = $ (document). ScrollTop ();/*position of scroll bar*/    varwindow_height = $ (window). Height ();/*the visible height of the screen*/    varBox_height = $ (". Tan_box"). Height ();/*the height of the bullet frame*/Top1= Top-scrolltop; Window_height= window_height/2; if(top1<window_height) {        if(top1<box_height/2){            varTOP2 =top+ -+box_height/2        }Else{            varTOP2 = window_height+ (top+ -)/2+box_height/2        }        $(". Tan_box"). CSS ("Top", TOP2); }Else{        if(window_height-top1<box_height/2){            varTOP2 = top- --box_height/2        }Else{            varTOP2 = (top+ -)/2+box_height/2        }        $(". Tan_box"). CSS ("Top", TOP2); }})

Author By:hgq Tuantuan

The problem of cursor misalignment in the input position:fixed popup box in IOS11

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.