请注意,本文编写于 3405 天前,最后修改于 2414 天前,其中某些信息可能已经过时。
打开多说embed.js,可以找到下列代码
      O = S.selectors = {
            ".ds-thread": {
                type: "EmbedThread"
            },
            ".ds-recent-comments": {
                type: "RecentComments"
            },
            ".ds-recent-visitors": {
                type: "RecentVisitors"
            },
            ".ds-top-users": {
                type: "TopUsers"
            },
            ".ds-top-threads": {
                type: "TopThreads"
            },
            ".ds-login": {
                type: "LoginWidget"
            },
            ".ds-thread-count": {
                type: "ThreadCount"
            },
            ".ds-share": {
                type: "ShareWidget"
            }
        },多说也够良心,给了这么多可以回调的函数,方便我们使用~
比如,回调评论框:
if ($('.ds-thread').length > 0) {
    if (typeof DUOSHUO !== 'undefined') DUOSHUO.EmbedThread('.ds-thread');
    else $.getScript("//static.duoshuo.com/embed.js");比如,回调评论数目
if ($('.ds-thread-count').length > 0) {
    if (typeof DUOSHUO !== 'undefined') DUOSHUO.EmbedThread('.ds-thread-count');
    else $.getScript("//static.duoshuo.com/embed.js");其他的回调方法同样类似。把回调的函数填到pjax:complete的事件中就可以。比较简单,不再赘述。
注:之前发现这个方法,一直懒得更,后来发现,这儿早有一篇介绍这个的文章了~http://www.4zen.top/ajaxed-load-duoshuo-count/ 如果想了解更多,可以去这儿再去看看看。
 
                             
                            
5 条评论
Pgksrjgiohi hw hweokfjeq ojfe jfweiogwo gwoj wijf gdhgtrj575 y6u75tyhgf 5yu5regr
牛哇
测试
留个坑以后懂了pjax再来看