jqueryはaudioラベルoncanplay,onended,onpauseおよびonplayイベントコールバックを傍受する

783 ワード

audioにも多くのイベント属性があり、これらのイベント属性を利用してこの音楽プレーヤーのオーディオの再生インタラクティブ効果を実現することができる.
例:
Mediaイベントのoncanplayイベント、onendedイベント、onpauseとonplayイベントなど
jQueryでこれらのイベントをリスニングする方法は、次のとおりです.








<p>          audio      "onended"   。</p>
<p>      ,        。</p>
<audio controls="">
    <source src="horse.ogg" type="audio/ogg">
    <source src="horse.mp3" type="audio/mpeg">
             audio   。
</source></source></audio>
<disable_script>
$(function(){
	$('audio').bind('ended', function(){	
		 alert('  ');
	})
	$('audio').bind('pause', function(){
		 alert('  ');
	})
	$('audio').bind('play', function(){
		 alert('    ');
	})
})	
</disable_script>

</code></pre>  <br/><div class="container-fluid p-0">

                                    <script async
                                            src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3219747971601011"
                                            crossorigin="anonymous"></script>
                                    <!-- jpdebug-blog-source-div -->
                                    <ins class="adsbygoogle"
                                         style="display:block"
                                         data-ad-client="ca-pub-3219747971601011"
                                         data-ad-slot="3872614099"
                                         data-ad-format="auto"
                                         data-full-width-responsive="true"></ins>
                                    <script>
                                        (adsbygoogle = window.adsbygoogle || []).push({});
                                    </script>
                                </div>

                                


                            </div>

                            <div class="row mb-4  pt-4 pb-4"><div class="col-6 text-primary ">
                                    <a class=" btn btn-outline-dark  small  float-left  "
                                       href="/p/2213836">
                                        <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"
                                             viewBox="0 0 24 24"
                                             fill="none" stroke="currentColor" stroke-width="2"
                                             stroke-linecap="round"
                                             stroke-linejoin="round" class="feather feather-arrow-left">
                                            <line x1="19" y1="12" x2="5" y2="12"></line>
                                            <polyline points="12 19 5 12 12 5"></polyline>
                                        </svg>

                                        pythonはそれぞれ100千ビットを求めます</a>
                                </div><div class="col-6  text-primary ">
                                    <a class=" btn btn-outline-dark small float-right "
                                       href="/p/2213843">jQエントリ関数、イベントの書き方
                                        <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"
                                             viewBox="0 0 24 24"
                                             fill="none" stroke="currentColor" stroke-width="2"
                                             stroke-linecap="round"
                                             stroke-linejoin="round" class="feather feather-arrow-right">
                                            <line x1="5" y1="12" x2="19" y2="12"></line>
                                            <polyline points="12 5 19 12 12 19"></polyline>
                                        </svg>


                                    </a>
                                </div></div>


                        </article>


                    </div>

                    <!-- end row -->
                </div> <!-- end card-body -->
            </div> <!-- end card -->
        </div>
        <!-- end chat area-->

        <!-- start user detail -->
        <div class="col-12 col-xxl-3 col-xl-3 ">

            <div class="card sticky-top" style="top: 20px;">
                <div class="row">


                    <aside class="col-md-12 col-xxl-12 d-none d-md-block   pt-0">
                        <div class="sticky">

                            <div class="container-fluid p-0 m-0 bg-light-off ">
                                <script async
                                        src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3219747971601011"
                                        crossorigin="anonymous"></script>
                                <!-- jpdebug-right-top-1 -->
                                <ins class="adsbygoogle"
                                     style="display:inline-block;width:300px;height:600px"
                                     data-ad-client="ca-pub-3219747971601011"
                                     data-ad-slot="1251860546"></ins>
                                <script>
                                    (adsbygoogle = window.adsbygoogle || []).push({});
                                </script>
                            </div>


                        </div>

                    </aside>

                </div>
                <div class="card-body">


                    <div class="row ">


                        <aside class="col-md-12 col-xxl-12 d-none d-md-block  pt-3">
                            <div class="sticky"><ul id="toc" class="nav flex-column toc overflow-scroll">

                                    <h4 class="nav-link h4 relate_nav_title text-dark" disabled>関連内容</h4><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3499000">WEB世界のストーカー</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3498984">[jQuery] マウスオーバーしたサムネイル画像をメイン画像に表示/切り替え</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3498978">【開発ログ⑰】サイドメニューの表示と非表示</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3498970">対話型コメント欄の非同期通信</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3498967">jQueryでパスワードの表示と非表示を切り替える</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3498934">【Rails】パスワードの2回入力は不要。1回にしてマスキング解除機能を実装【jQuery】</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3498929">[JS][Rails]プレビュー付き画像アップロードで画像枚数に制限をかけよう!!</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3498573">Pepperのタブレット上でvConsoleを使ってJavaScriptのログを確認する</a>
                                    </li><li class="nav-item">
                                        <a data-scroll class="nav-link text-black-50"
                                           href="/p/3497790">Spring 案件ソルーション画面系2 手順書フォルダ</a>
                                    </li></ul><!--                                <div class="container-fluid p-0">-->
<!--                                    <script async-->
<!--                                            src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3219747971601011"-->
<!--                                            crossorigin="anonymous"></script>-->
<!--                                    <!– jpdebug-post-right –>-->
<!--                                    <ins class="adsbygoogle"-->
<!--                                         style="display:block"-->
<!--                                         data-ad-client="ca-pub-3219747971601011"-->
<!--                                         data-ad-slot="8535334719"-->
<!--                                         data-ad-format="auto"-->
<!--                                         data-full-width-responsive="true"></ins>-->
<!--                                    <script>-->
<!--                                        (adsbygoogle = window.adsbygoogle || []).push({});-->
<!--                                    </script>-->
<!--                                </div>-->


                            </div>

                        </aside>
                    </div>
                </div> <!-- end card-body -->
            </div> <!-- end card-->
        </div> <!-- end col -->
        <!-- end user detail -->
    </div>


</div><!-- footer -->
<footer class="bg-light p-3 mt-5">
    <div class="container">
        <div class="row gutter-3">

            <div class="col-12 col-md-12 text-white text-center text-lowercase">
                <p class="mb-0 text-black-50 small text-lowercase">©2022 jpdebug.com. All Rights Reserved. | <a
                        href="/privacy" target="_blank" class="text-dark" rel="nofollow">Privacy Policy</a> | <a
                        href="/contact_us"
                        target="_blank"
                        class="text-dark" rel="nofollow">Contact
                    US</a> | <a href="/sitemap.xml" target="_blank" class="text-dark" rel="nofollow">Sitemap</a></p>

            </div>

        </div>
    </div>
</footer>
<!-- / footer -->

<!-- Bootstrap 4 Version -->
<div class="nk-cookie-banner alert alert-secondary text-center mb-0 small" role="alert"
     style="background: rgba(255, 255, 255, .6);border-color:#f2f2f2;-webkit-backdrop-filter: blur(10px);backdrop-filter: blur(20px);">
    🍪このウェブサイトは、あなたが我々のウェブサイトで最高の経験を得ることを確実とするために、クッキーを使います。
    <a href="/privacy" target="blank" rel="nofollow">プライバシー条項の表示</a>
    <button type="button" class="btn btn-primary btn-sm ml-3 shadow-none" onclick="window.nk_hideCookieBanner()">
        同意します
    </button>
</div><!-- JS Global Compulsory hs-builder:build-delete -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>


<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/highlight.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>

<script src="/static/all_theme_package/quick-website.min.js"></script>

<script src="/static/all_theme_package/cookie-banner.js"></script><script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?d95bbf01f0dd90da512ecedf1d9661bd";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

<script async src="//static.getclicky.com/101379076.js"></script>

<!--<script>-->
<!--    $(document).ready(function () {-->

<!--        $("pre").addClass("language-none");-->

<!--    });-->
<!--</script>-->
<script src="/static/all_theme_package/auto-enable-prism.js"></script>
<script src="/static/all_theme_package/prism.min.js"></script></body>

</html><script src="/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js" data-cf-settings="b6eccd278a05f8f9dc2043ed-|49" defer></script>