admin管理员组文章数量:1435823
I'm trying to add update the jQuery Terminal cursor position when text selection cursor is visible. This is my code:
function update_mobile_cursor() {
if (is_mobile) {
var selection = document.getSelection();
console.log(selection);
if (selection.anchorNode === selection.focusNode) {
var range = selection.getRangeAt(0);
console.log(range);
self.position(range.endOffset);
}
}
}
But both selection and range exists even when the selection cursor is not visible. When I type something, the endOffset
points into the last typed character.
Is there a way to detect the visibility of the selection cursor on a mobile Browser?
I have a testing webpage: .php when You press backspace it jumps to the beginning.
NOTE: that the function don't trigger when text selection is changed, I've asked about it here: Listen to cursor change on mobile browser
I test this with Chromium based Brave.
本文标签: javascripthow to detect if cursor text selection is visible on mobile browserStack Overflow
版权声明:本文标题:javascript - how to detect if cursor text selection is visible on mobile browser? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745630685a2667255.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论