当前位置:网站首页>Get the direction of text selection
Get the direction of text selection
2022-07-26 21:26:00 【Ziwei front end】
forward If the user selects text from left to right , Then the following function returns . In another case, it will return backward.
const getDirection = function () {
const selection = window.getSelection();
const range = document.createRange();
range.setStart(selection.anchorNode, selection.anchorOffset);
range.setEnd(selection.focusNode, selection.focusOffset);
return range.collapsed ? 'backward' : 'forward';
};边栏推荐
- idea中检索此方法中有哪些参数以便我们使用——1.类图。2.双击shift
- Alkbh1
- Valley segment coverage - (summary of interval sequencing problem)
- How to implement Devops with automation tools | including low code and Devops application practice
- 【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用的数据恢复
- 【Oracle实训】-部署号称零停机迁移的OGG
- GOM login configuration free version generate graphic tutorial
- Detailed illustration of B-tree and its implementation in C language
- Web3.0 时代,基于P2PDB实现一款Dapp的技术理论
- Soft test --- database (1) database foundation
猜你喜欢

Devsecops, speed and security

We were tossed all night by a Kong performance bug

What are the characteristics of low code tools? The two development tracks of low code that can be seen by discerning people!

如何借助自动化工具落地DevOps|含低代码与DevOps应用实践

How to use multiple languages in a project?

【MySQL系列】-索引知多少

Test cases should never be used casually, recording the thinking caused by the exception of a test case

Go+mysql+redis+vue3 simple chat room, the sixth bullet: use vue3 and element plus to call the interface

How to implement Devops with automation tools | including low code and Devops application practice

Remember the idea of solving the problem of invalid bound statement xxxxx once
随机推荐
Soft test --- database (1) database foundation
Retrieve the parameters in this method in idea for our use -- 1. Class diagram. 2. Double click shift
Pointpillars: fast encoders for object detection from point clouds reading notes
Web3.0 时代,基于P2PDB实现一款Dapp的技术理论
6种方法帮你搞定SimpleDateFormat类不是线程安全的问题
About: get the domain controller of the current client login
contenteditable 元素的placeholder
【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用的数据恢复
<button> 与 <input type=“button“ />
记一次invalid bound statement xxxxxx 问题解决思路
【Oracle实训】-部署号称零停机迁移的OGG
使用 LSTM 进行多变量时间序列预测--问题汇总
测试用例千万不能随便,记录由一个测试用例异常引起的思考
一些意想不到的bug记录
我们从Crypto市场中学到的最艰难一课
Apaas low code platform (I) | leave complexity to yourself and simplicity to users
GOM and GEE lander list file encryption tutorial
[HCIA security] user authentication
滤波及失真
4年软件测试工作经验,跳槽之后面试20余家公司的总结