jPlayer在调用jQuery.load()方法时停止刷新chrome上的内容但在firefox上运行

Akh*_*wal 5 safari jquery google-chrome jplayer

我正在使用jPlayer播放音频.我们需要不间断的比赛.为此,我们使用jQuery.load()方法加载页面内容并替换页面上的内容.

我们没有以任何方式刷新jPlayer内容.

代码在firefox中工作正常,jPlayer播放音频而不会中断.但是在chrome和safari上,jPlayer会在执行jquery load方法后停止然后重新启动.

此外,当我在本地计算机上运行代码时,它们在任何浏览器中都不会中断.只有当我在服务器上运行代码时,它们才会中断.

我们需要音乐不受干扰.

我的代码如下:

function loadContent(pagePath) {
    //Method called on menu click to load content without page refresh
    //Loading the said page (pagePath - relative path of page)
    jQuery('#containerDiv').fadeOut(200, function() {
    jQuery('#waitingDiv').show();
        jQuery(this).empty();
        jQuery(this).load(pagePath, function() {
        jQuery(this).fadeIn(200, function() {
            jQuery('#waitingDiv').hide();
        });
    });
    });
}

//JPlayer initiation code on first page load
jQuery("#jquery_jplayer_1").jPlayer({
    ready: function () {
        jQuery(this).jPlayer("setMedia", {mp3: '../'+path});
    },
    swfPath: "../swf",
    supplied: "mp3",
    wmode: "window"
});
Run Code Online (Sandbox Code Playgroud)

有什么建议?

谢谢Akhilesh Aggarwal

小智 1

尝试将 JPlayer 启动代码移至 loadContent 函数上方