Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript safari和firefox中的声音问题(在鼠标上播放mp3,单击)_Javascript_Jquery_Firefox_Safari - Fatal编程技术网

Javascript safari和firefox中的声音问题(在鼠标上播放mp3,单击)

Javascript safari和firefox中的声音问题(在鼠标上播放mp3,单击),javascript,jquery,firefox,safari,Javascript,Jquery,Firefox,Safari,这段代码在chrome中运行得非常完美,但在firefox和safari中却无法播放声音——我尝试了一些其他方法来实现这一功能,但在鼠标上组合一个声音并在点击时循环并没有解决方案有人知道解决办法吗 }) 你试过其他格式吗?这些浏览器可能不支持.wav?我不知道你的目标,但你也可以找一个CrossBrowser音频插件。我试过buzzjs一次,效果非常好,但我不知道它是否仍然更新OK,非常感谢。我试试这个。我的主要问题是,我不知道我应该在哪里寻找问题。 $(document

这段代码在chrome中运行得非常完美,但在firefox和safari中却无法播放声音——我尝试了一些其他方法来实现这一功能,但在鼠标上组合一个声音并在点击时循环并没有解决方案有人知道解决办法吗


})

你试过其他格式吗?这些浏览器可能不支持.wav?我不知道你的目标,但你也可以找一个CrossBrowser音频插件。我试过buzzjs一次,效果非常好,但我不知道它是否仍然更新OK,非常感谢。我试试这个。我的主要问题是,我不知道我应该在哪里寻找问题。
            $(document).ready(function () {
      var audioElement = document.createElement('audio');
      audioElement.setAttribute('src', 'audio/01T.wav');
      audioElement.setAttribute('autoplay:false', 'autoplay');

      $.get();
      audioElement.addEventListener("load", function () {
          audioElement.play();
      }, false);

      $('.letter1').mouseenter(function () { 
        $(this).addClass('shake shake-constant').stop().delay(3000).queue(function(){
        $(this).removeClass('shake shake-constant');
          });
          audioElement.play();
      });


      var audioElementb = document.createElement('audio');
      audioElementb.setAttribute('src', 'audio/01T.wav');
      audioElementb.setAttribute('autoplay:false', 'autoplay');
      audioElementb.loop=true;

      $.get();
      audioElementb.addEventListener("load", function () {
          audioElementb.play();
      }, false);

      $('.letter1').on('click', function(){
         $( this ).toggleClass( "serif shake2 shake-constant2" );


      if (audioElementb.paused) {
       audioElementb.play();
      } else {
       audioElementb.pause();
        }
      });