5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

タッチスクリーン長押しのときにテキスト選択の色が付いてほしくない場合

Last updated at Posted at 2015-05-08

よく私が使うcssとeventがこちら

#テキスト選択無効

	-webkit-user-select: none;
	-ms-user-select: none;
	user-select: none;

#ハイライト透明

	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
	-ms-tap-highlight-color: rgba(0, 0, 0, 0);
	tap-highlight-color: rgba(0, 0, 0, 0);

#タッチスクロール禁止

	-webkit-touch-action: none;
	-ms-touch-action: none;
	touch-action: none;

#テキスト選択禁止

element.addEventListener("selectstart", function(e) { e.preventDefault(); }, false);

完璧というわけではないが、少なくともマシな動作にはなるのかと

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?