使用jquery colorbox在blogger帖子上加载Disqus评论

时间:2016-07-21 10:30:01

标签: javascript jquery ajax blogger disqus

我正在 blogger 网站上发表 Disqus 评论,我正在尝试将评论加载到jquery colorbox

我在</body>标记顶部有两个脚本,用于加载一些Disqus js文件。第一个脚本加载count.js,第二个脚本加载embed.js

HTML

<i class='fa fa-comment'/>
<a class='show-comments'>
    <span class="disqus-comment-count" data-disqus-url='***'>Counting...</span>
</a>
<div id='disqus_thread'/>

调用count.js

<script id="dsq-count-scr" src="//***.disqus.com/count.js" async='async'></script>

调用embed.js

<script type='text/javascript'>
    $(document).ready(function() {
        $('.show-comments').on('click', function(){
            var disqus_shortname = '***'; // Replace this value with *your* username.

            // ajax request to load the disqus javascript
            $.ajax({
                type: "GET",
                url: "http://" + disqus_shortname + ".disqus.com/embed.js",
                dataType: "script",
                cache: true
            });
            // hide the button once comments load
            $(this).fadeOut();
        });
    });     
</script>

所以,毕竟,我也希望当用户点击show-comments链接将Disqus评论加载到colorobox !!!

我尝试了一些内容,例如在链接中添加inline类,并将href指向Disqus评论主体的#comments ID,但没有。有什么想法吗?

0 个答案:

没有答案