Javascript插件无法在Safari

时间:2016-05-30 20:06:43

标签: javascript jquery wordpress safari

我在Wordpress中安装了一个插件。插件名称是健全的背景音乐。该插件适用于除工作Safari之外的所有浏览器:声音无法播放,按钮暂停无效。

错误是:

  

typeerror undefined不是函数
  (评估_this.audio_player_element.pause()')

这是下载文件js的链接

https://www.wetransfer.com/downloads/c2169c2ad8096778decaed1df7304cd520160530203306/397086fa9a12eba87669072851c7e0da20160530203306/33f9d1

1 个答案:

答案 0 :(得分:1)

1)因为有.attr(),我假设你正在使用jQuery    你可能正在使用多个jquery脚本(彼此竞赛)。

2)因为有_这是你的范围,你实际上可能正在调用超出范围的对象。

3)如果您使用的脚本不适用于Safari,那么这就是正在发生的事情。

if( _this.audio_player_element.paused )
   {
     //you will never reach this because audio_player_element is undefined which gives false due to your scope or being taken by another jquery $ script
   }
        else
   {
    //you will always end up here, and you are trying to pause() the undefined.
   }
相关问题