CC's blog

CC的技术博客 专注于 it 互联网的技术爱好者

Pajax 局部刷新 保证本站音乐播放器不因刷新中断播放

<!--异步刷新-->
<script>
    $(document).pjax('a[target!=_blank]', '#left', {fragment:'#left', timeout:8000});

</script>

<div class="pjax_loading"></div>
<script>
$(document).on('pjax:send', function() { //pjax链接点击后显示加载动画;
    $(".pjax_loading").css("display", "block");
});
$(document).on('pjax:complete', function() { //pjax链接加载完成后隐藏加载动画;
    $(".pjax_loading").css("display", "none");
});
</script>

<script>
$(document).on('pjax:complete', function() {
    pajx_loadDuodsuo();//pjax加载完成之后调用重载多说函数

    prettyPrint();
});
function pajx_loadDuodsuo(){
    var dus=$(".ds-thread");
    if($(dus).length==1){
        var el = document.createElement('div');
        el.setAttribute('data-thread-key',$(dus).attr("data-thread-key"));//必选参数
        el.setAttribute('data-url',$(dus).attr("data-url"));
        DUOSHUO.EmbedThread(el);
        $(dus).html(el);
    }
}
</script>


<!--异步刷新--> 


none

添加新评论