aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/htmlelement/transitionrun_event/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/api/htmlelement/transitionrun_event/index.html')
-rw-r--r--files/ja/web/api/htmlelement/transitionrun_event/index.html144
1 files changed, 144 insertions, 0 deletions
diff --git a/files/ja/web/api/htmlelement/transitionrun_event/index.html b/files/ja/web/api/htmlelement/transitionrun_event/index.html
new file mode 100644
index 0000000000..18733814d9
--- /dev/null
+++ b/files/ja/web/api/htmlelement/transitionrun_event/index.html
@@ -0,0 +1,144 @@
+---
+title: 'HTMLElement: transitionrun イベント'
+slug: Web/API/HTMLElement/transitionrun_event
+tags:
+ - CSS Transitions
+ - CSS トランジション
+ - DOM
+ - Event
+ - Reference
+ - Transitions
+ - Web
+ - events
+ - transitionrun
+ - イベント
+ - ウェブ
+ - トランジション
+translation_of: Web/API/HTMLElement/transitionrun_event
+---
+<div>{{APIRef}}{{SeeCompatTable}}</div>
+
+<p><strong><code>transitionrun</code></strong> イベントは、 <a href="/ja/docs/CSS/Using_CSS_transitions">CSS トランジション</a>が最初に生成されたとき、すなわち、 {{cssxref("transition-delay")}} が始まる前に発生します。</p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">バブリング</th>
+ <td>あり</td>
+ </tr>
+ <tr>
+ <th scope="row">キャンセル可能</th>
+ <td>いいえ</td>
+ </tr>
+ <tr>
+ <th scope="row">インターフェイス</th>
+ <td>{{domxref("TransitionEvent")}}</td>
+ </tr>
+ <tr>
+ <th scope="row">イベントハンドラープロパティ</th>
+ <td>{{domxref("GlobalEventHandlers/ontransitionrun", "ontransitionrun")}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Examples" name="Examples">例</h2>
+
+<p>このコードは <code>transitionrun</code> イベントのリスナーを追加します。</p>
+
+<pre class="brush: js notranslate">el.addEventListener('transitionrun', () =&gt; {
+ console.log('Transition is running but hasn\'t necessarily started transitioning yet');
+});</pre>
+
+<p>同じですが、 <code><a href="/ja/docs/Web/API/GlobalEventHandlers/ontransitionrun">ontransitionrun</a></code> プロパティを <code>addEventListener()</code> の代わりに使用した例です。</p>
+
+<pre class="brush: js notranslate">el.ontransitionrun = () =&gt; {
+ console.log('Transition started running, and will start transitioning when the transition delay has expired');
+};</pre>
+
+<div>
+<h3 id="Live_example" name="Live_example">ライブ例</h3>
+
+<p>以下の例では、単純な {{htmlelement("div")}} 要素を用い、遅延を含むトランジションでスタイル付けしています。</p>
+
+<pre class="brush: html notranslate">&lt;div class="transition"&gt;Hover over me&lt;/div&gt;
+&lt;div class="message"&gt;&lt;/div&gt;</pre>
+
+<pre class="brush: css notranslate">.transition {
+ width: 100px;
+ height: 100px;
+ background: rgba(255,0,0,1);
+ transition-property: transform, background;
+ transition-duration: 2s;
+ transition-delay: 1s;
+}
+
+.transition:hover {
+ transform: rotate(90deg);
+ background: rgba(255,0,0,0);
+}</pre>
+
+<p>このために、 {{domxref("HTMLElement/transitionstart_event", "transitionstart")}} および {{domxref("HTMLElement/transitionrun_event", "transitionrun")}} イベントが発生する場所を示す JavaScript を追加します。</p>
+
+<pre class="brush: js notranslate">const el = document.querySelector('.transition');
+const message = document.querySelector('.message');
+
+el.addEventListener('transitionrun', function() {
+ message.textContent = 'transitionrun fired';
+});
+
+el.addEventListener('transitionstart', function() {
+ message.textContent = 'transitionstart fired';
+});
+
+el.addEventListener('transitionend', function() {
+  message.textContent = 'transitionend fired';
+});
+</pre>
+
+<p>{{ EmbedLiveSample('Live_example', '100%', '150px') }}</p>
+</div>
+
+<p>相違点は以下のとおりです。</p>
+
+<ul>
+ <li><code>transitionrun</code> は、トランジションが生成されるときに発生します (つまり、遅延時間の始め)。</li>
+ <li><code>transitionstart</code> は実際にアニメーションが始まるときに発生します。 (つまり、遅延時間の終わり)。</li>
+</ul>
+
+<p><code>transitionrun</code> は、遅延時間が終わる前にトランジションが中止されたときにも発生します。トランジションの遅延時間がなかったり、 transition-delay が負の数であった場合には、 <code>transitionrun</code> と <code>transitionstart</code> の両方が発生します。</p>
+
+<h2 id="Specifications" name="Specifications">仕様書</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">仕様書</th>
+ <th scope="col">状態</th>
+ <th scope="col">備考</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS3 Transitions', '#transitionrun', 'transitionrun')}}</td>
+ <td>{{Spec2('CSS3 Transitions')}}</td>
+ <td>初回定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>
+
+<p>{{Compat("api.HTMLElement.transitionrun_event")}}</p>
+
+<h2 id="See_also" name="See_also">関連情報</h2>
+
+<ul>
+ <li>{{domxref("GlobalEventHandlers.ontransitionsrun")}} イベントハンドラー</li>
+ <li>{{domxref("TransitionEvent")}} インターフェイス</li>
+ <li>CSS プロパティ: {{cssxref("transition")}}, {{cssxref("transition-delay")}}, {{cssxref("transition-duration")}}, {{cssxref("transition-property")}}, {{cssxref("transition-timing-function")}}</li>
+ <li>関連イベント: {{domxref("HTMLElement/transitionend_event", "transitionend")}}, {{domxref("HTMLElement/transitionstart_event", "transitionstart")}}, {{domxref("HTMLElement/transitioncancel_event", "transitioncancel")}}</li>
+ <li>{{domxref("Document")}} に対するこのイベント: {{domxref("Document/transitionrun_event", "transitionrun")}}</li>
+ <li>{{domxref("Window")}} に対するこのイベント: {{domxref("Window/transitionrun_event", "transitionrun")}}</li>
+</ul>