Worldpress ලොකු උදව්වක්

sajith1100

Well-known member
  • May 27, 2012
    457
    295
    63
    Untitled.png


    මේ විදියට Audio Player Worldpress Site එකකට දාගන්නේ කොහොමද මචං.

    1723621533796.png


    දැනට මගේ තියෙන්නේ මෙහෙමයි, මේකෙදි එකක් Play කලාම අනිත් එක Play කරද්දී කලින් එක Stop වෙන්නේ නෑ ඒ නිසා දෙකම Play වෙනවා, අහන කෙනා අනිත් එක Off කරන්න ඕනි, උඩ Site එකේ තියෙන Player එකේ එහෙම නෑ. මට පුළුවන් නම් මේක හදාගන්න හෙල්ප් එකක් දෙන්න පුලුවන්ද මචං.
     

    Nidarshana_k

    Well-known member
  • Feb 19, 2022
    29,577
    1
    51,268
    113
    ප*යාගල
    sorry.com
    Try

    • Step 1: Insert your audio files into the WordPress post or page using the default audio blocks or shortcodes.
    • Step 2: Add the following custom JavaScript code to your WordPress site:
      javascript




    • document.addEventListener("DOMContentLoaded", function() {
      var audioPlayers = document.querySelectorAll("audio");
      audioPlayers.forEach(function(audio) {
      audio.onplay = function() {
      audioPlayers.forEach(function(otherAudio) {
      if (otherAudio !== audio && !otherAudio.paused) {
      otherAudio.pause();
      }
      });
      };
      });
      });

    • Step 3: Add this JavaScript to your site using the Custom HTML block in the WordPress editor, or by using a plugin like Insert Headers and Footers to place the script in the footer of your site.
     
    • Love
    Reactions: sajith1100