当前位置:网站首页>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';
};边栏推荐
- Broadcast voice H5 speechsynthesisutterance
- Arm TZ hardware support
- JDBC connection
- GOM and GEE lander list file encryption tutorial
- Introduction to the billing function of wechat payment
- idea中检索此方法中有哪些参数以便我们使用——1.类图。2.双击shift
- Computer professional interview topic summary, general navigation
- 修改excel默认编码
- Remember the idea of solving the problem of invalid bound statement xxxxx once
- Live broadcast appointment award | senior consultant xuyanfei: how does efficiency measurement help efficient and sophisticated outsourcing management
猜你喜欢

Live broadcast appointment award | senior consultant xuyanfei: how does efficiency measurement help efficient and sophisticated outsourcing management

Mobile phone \ landline call forwarding setting method

IT系统为什么需要可观测性?

一种用于实体关系抽取的统一标签空间

idea中debug时如何进入指定的用户方法体中?

记一次invalid bound statement xxxxxx 问题解决思路

JVM学习----内存结构----程序计数器&虚拟机栈&本地方法栈&堆&方法区

关于:获取当前客户端登录的域控

LeetCode 练习——剑指 Offer II 005. 单词长度的最大乘积

【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用的数据恢复
随机推荐
IT系统为什么需要可观测性?
Basic use of livedatade
2022-7-26 第七组 抽象和接口
加载 iframe 时显示加载指示器
Difference between redis hash and string
GOM login configuration free version generate graphic tutorial
银河证券场内基金低佣金开户靠谱吗,可靠安全吗
Ros2 method of obtaining current system time
一种用于实体关系抽取的统一标签空间
encodeURI VS encodeURIComponent
[problem] process the set [','] into (',')
TypeScript中的类型断言
idea中debug时如何进入指定的用户方法体中?
Redis hash和string的区别
LiveDatade的基本使用
Is it safe for Huishang futures to open an account? What should Huishang futures pay attention to when opening an account?
JVM学习----内存结构----程序计数器&虚拟机栈&本地方法栈&堆&方法区
conda报错:json.decoder.JSONDecodeError:
[must read new] Keya valuation analysis of University of technology, heating energy-saving products
LeetCode 练习——剑指 Offer II 005. 单词长度的最大乘积