Disqus 评论系统 - 边距左偏移

发布于 2024-12-17 22:45:41 字数 95 浏览 1 评论 0原文

我需要增加父母评论(回复评论)的空白。 左边距现在是 46px、58px 等。

是否有某种方法可以设置 margin-left disqus 应该用来偏移注释?

I need to increase the margin-left on comments that are parents (comments that are replies).
The margin left is now 46px, 58px etc.

Is there some way to set the margin-left disqus should offset comments with?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撕心裂肺的伤痛 2024-12-24 22:45:41

通过脚本回答

如果你指的是评论上的评论上的评论,可以使用下面的方法,每个parent的偏移量为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; }

Answer through script

If you mean comments on comments on comments, you can use the following method, which has an offset of 46 + 12 for each parent.

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

Answer through CSS

If you got a static amount of comments, you can use css

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

Best solution

But it's better to nest them, so you can just use margin-left: 12px; and the nested already moved 12px and now his margin will be there aswell. So moved another 12px.

Then the HTML will ook like:

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

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

And the CSS:

ul{ margin-left: 12px; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文