gpt4 book ai didi

javascript - Disqus 评论系统 - 边距左偏移

转载 作者:太空宇宙 更新时间:2023-11-03 19:11:08 25 4
gpt4 key购买 nike

我需要增加作为父项的评论(作为回复的评论)的边距。左边距现在为 46px、58px 等。

有什么方法可以设置 margin-left disqus 应该用来抵消评论吗?

最佳答案

通过脚本回答

如果你的意思是对评论的评论进行评论,你可以使用下面的方法,每个父级的偏移量为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; }

关于javascript - Disqus 评论系统 - 边距左偏移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8255357/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com