aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/animation/oncancel
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/animation/oncancel
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/animation/oncancel')
-rw-r--r--files/zh-cn/web/api/animation/oncancel/index.html111
1 files changed, 111 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/animation/oncancel/index.html b/files/zh-cn/web/api/animation/oncancel/index.html
new file mode 100644
index 0000000000..00e9b0fc98
--- /dev/null
+++ b/files/zh-cn/web/api/animation/oncancel/index.html
@@ -0,0 +1,111 @@
+---
+title: Animation.oncancel
+slug: Web/API/Animation/oncancel
+tags:
+ - API
+ - Animation
+translation_of: Web/API/Animation/oncancel
+---
+<p>{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}</p>
+
+<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a> 的 {{domxref("Animation")}} 接口的 <code><strong>oncancel</strong></code> 属性是 {{event("cancel")}} 事件的事件处理程序。</p>
+
+<p>当动作从其他状态进入 <code>"idle"</code> 播放状态,例如当动画在结束播放后从元素中移除时,<code>cancel</code> 事件可以 {{domxref("Animation.cancel()")}} 被手动触发。 </p>
+
+<div class="note">
+<p>在新的动画中,创建一个新的初始的空闲动画不会触发 {{event("cancel")}} 事件。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">var <em>cancelHandler</em> = <em>Animation</em>.oncancel;
+
+<em>Animation</em>.oncancel = <em>cancelHandler</em>;</pre>
+
+<h3 id="值">值</h3>
+
+<p>当动画被取消时,这个函数将会被执行。默认是 <code>null</code> 。</p>
+
+<h2 id="例子">例子</h2>
+
+<p>如果动画被取消,将会从元素中移除它。</p>
+
+<pre class="brush: js">animation.oncancel = animation.effect.target.remove();
+</pre>
+
+<h2 id="标准">标准</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">标准</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}</td>
+ <td>{{Spec2('Web Animations')}}</td>
+ <td>编辑草案中。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>功能</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>基础支持</td>
+ <td>{{CompatChrome(39.0)}}</td>
+ <td>{{CompatGeckoDesktop(48)}}<sup>[1]</sup></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>功能</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>基础支持</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile(48)}}<sup>[1]</sup></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] Web Animations API 默认在 Firefox Developer Edition 和 Nightly builds 被启用。你可以在设置属性 <code>dom.animations-api.core.enabled 为 true 时在 Beta 和 发行版 开启这个功能,</code>你可以设置为 <code>false </code>来禁用这个功能。</p>
+
+<h2 id="参见" style="line-height: 30px; font-size: 2.14285714285714rem;">参见</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a></li>
+ <li>{{domxref("Animation")}}</li>
+ <li>{{event("cancel")}} 事件</li>
+</ul>