LoginSignup
0

More than 5 years have passed since last update.

ZeroClipboardで擬似クラスのスタイルを適用させる

Posted at

概要

フロントエンドでクリップボードにテキストをコピーすることができるライブラリ「ZeroClipboard」を使ってると、bindさせるエレメントのstyleでbutton:hoverとかが使えない問題が発生した。

よく見たらissueに書いてあった。

解決策

擬似クラスではなくクラス名でstyleを定義する。

例えば<button class="hoge">なら

button.hoge.zeroclipboard-is-hover { background-color: #eee; }

とかやるとhover時スタイルが適用される。

恐ろしい。

所感

ButtonクリックイベントでHTML5 Clipboard APIを叩く方法があればそっちでいいのかもしれない。

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
0