Can't get Position&Container Infomation by Click the iPad - javascript

In chrome or Safari browser, when I select the text on the page I can get the Selection-info by window.getSelection(), And it worked on iPad too.
But when I just click , in browser, I will get a window.getSelection (isCollapsed==true) with full infomation about the position and container . In iPad it just tell you the selection isCollapsed but the position info is 0 or null.
Anyone have an idea how to get the container and the position info when you click in iPad?

Basically using touch events you could do this. It is not just the selection but the number of the fingers you used too. It works on iPad on iPhones on almost every mobile. After setting your handlers for touch events you can map them easily to fire the click events or do something else.

Related

Activate touch events on Chrome 71+

I want to activate touch events on Chrome to facilitate the debugging of an app that uses touchstart and touchend events.
It seems this post is a bit outdated because I cannot get the Overrides menu when I go to the developer settings, not on Chrome nor on Chrome Developer. This is what I get on Chrome Dev 73:
I've searched thoroughly in the settings but no sight of this checkbox. I've seen no up-to-date tutorial to activate them. How can I do?
Thank you for your help.
Two methods in the devtools:
Press Escape to show the drawer at the bottom. Choose menu > Sensors. At the bottom, set Touch = Force enabled.
Turn on Device Toolbar (second button at the top). Choose menu > Add device type. Set it to either "Mobile" or "Desktop (touch)".
Both of these should enable touch events.
It should be a chrome flag. Type this address into the chrome URL bar:
chrome://flags/#touch-events
it should highlight the Touch Events API, after that just press the drop-down box and change it to enabled.

materialize css select box issues in Internet explorer

materializecss select box in Internet explorer 9 or more it can't be able to scroll using mouse button,click on the scroll bar inside the select box it diapers. But all other remaining browsers working properly.
i have also attached the sample screen shot,kindly help to solve this issue..
You will need to add a behavior for mouse down events in addition to triggering a close. Check out issue #901 at https://github.com/Dogfalo/materialize/issues/901

Android browsers keyboard opens/closes on last input field focus

I'm getting some odd behaviour in the Chrome browser on HTC One and Galaxy S5.
I click on an input field to enter some data and the keyboard opens and immediately closes again.
I've noticed it only happens on the last available input field on my pages.
Has anyone encountered this issue before?
It works fine on the iPhone and desktop browsers.
Thanks
Ok...so it looks like it has something to do with android browsers redrawing the DOM whenever the keyboard appears. I have $(window).resize() function that is getting called each time the keyboard appears in this case. I may just switch it to use $(window).load().

WinJs textarea focus issue

When running http://ichord.github.io/At.js/ page in IE10, it works correctly in a sense it returns focus to textarea after selecting suggestion from autocomplete list. It also works when I use on screen keyboard and touch input (on surface rt or simulator).
When I try to run the same code as WinJs app, it works for mouse/keyboard selection, but when I select item using touch it doesn't return focus to textarea, which is really frustrating.
Is it known bug? Are there any known workarounds to it?
What it interesting it also doesn't hide on screen keyboard.

How to capture the hide keyboard event on iOS using JavaScript

I need to do some resizing of the content of a web page when the hide keyboard button is pressed on an iPad virtual keyboard. Which JavaScript event is launched when the keyboard is hidden?
You can use the focusout event. It's like blur, but bubbles. It will fire when the keyboard closes (but also in other cases, of course). In Safari and Chrome the event can only be registered with addEventListener, not with legacy methods. Here is an example I used to restore a Phonegap app after keyboard dismissal.
document.addEventListener('focusout', function(e) {window.scrollTo(0, 0)});
Without this snippet, the app container stayed in the up-scrolled position until page refresh.
Here is a good place to start List of supported Javascript events on iPad
which leads to https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW5
which does not list it.
This one gives a work around iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari?
window.onblur = function(e) {
window.scrollTo(0, 1);
};
This is my solution, which works fine, if someone pressed the "closekeyboard" for iOS 14.7 .

Categories