简体   繁体   English

通过矩形区域JS选择多个文本元素

[英]Select across multiple text elements via rectangular area JS

I don't want to use the device's native text selecting ability, rather I want to replace it with my own method.我不想使用设备的本机文本选择功能,而是想用我自己的方法替换它。 How can I select text across multiple elements based off of coordinate positions on the page?如何根据页面上的坐标位置跨多个元素选择文本?

Basically, I have the results of Touch clientX/clientYs to make a rectangular area and I want to select all the text contained in that area基本上,我有 Touch clientX/clientYs 的结果来制作一个矩形区域,我想选择该区域中包含的所有文本

I've tried using absolutely-positioned elements and creating a range with those elements as the bounding start and end but it did not work.我尝试使用绝对定位的元素并创建一个以这些元素作为边界开始和结束的范围,但它不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM