Prevent selection when dragging
- 2021-07-16 01:19:22
- OfStack
Sometimes, when dragging, it will affect dragging because it is selected, or cause 1 bug. However, use the following code to prevent it from being selected.
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();