首页 > 多说怎么才能和 pjax 适配呢?

多说怎么才能和 pjax 适配呢?

使用了 pjax 之后再点开链接,多说就无法正常加载了,必须重新刷新当前页面才行。


前两天刚刚折腾的。

function duoshuo(postid, posturl,posttitle) {
    var el = document.createElement('div');
    el.setAttribute('data-thread-key', postid);
    el.setAttribute('data-title', posttitle);
    el.setAttribute('data-url', posturl);
    DUOSHUO.EmbedThread(el);
    jQuery("#duoshuo").append(el);
}

载入页面的时候执行 duoshuo(postid, posturl,posttitle);

可以参考 http://miantiao.me/


你看一下多说的帮助文档 http://dev.duoshuo.com/docs/50b344447f32d30066000147
这个动态加载的说明吧。
你参考一下
http://www.prdblog.com/html/index/duoshuo.html 这个网站的实现吧。他是用pjax的。也用了多说的。

解决方式跟 @ccbikai 差不多的。


分析他的加载代码,dom 操作完,重新加载一次。
应该是挺好操作的,因为默认它肯定要载入的,源码里是明显能找到的。

【热门文章】
【热门文章】