Disqus评论系统 - 边距左偏移

时间:2011-11-24 10:13:54

标签: javascript jquery css wordpress disqus

我需要增加父母评论的留存余额(评论是回复)。 剩下的保证金现在是46px,58px等。

有没有办法设置margin-left disqus应该用?

来补充注释

1 个答案:

答案 0 :(得分:0)

通过脚本回答

如果您对评论的评论意味着评论,您可以使用以下方法,每个父母的偏移量为46 + 12。

$(".comment:not(.changed)").each(function(){
    $(this).addClass("changed");
    var parents = $(this).parents(".comments");
    $(this).css("marginLeft", 46 + ( parents.length * 12));
});

通过CSS回答

如果你收到了一定数量的评论,你可以使用css

.comment{ margin-left: 46px; }
.comment .comment{ margin-left: 58px; }
.comment .comment .comment{ margin-left: 70px; }

最佳解决方案

但是最好将它们嵌套,所以你可以使用margin-left: 12px;并且嵌套已经移动了12px,现在他的边距也会存在。所以又移了12px。

然后HTML会像:

<ul>
    <li>COMMENT
        <ul>
            <li>COMMENT

                <ul>...ETC</ul>
            </li>
        </ul>
    </li>
</ul>

CSS:

ul{ margin-left: 12px; }