Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Discus注释系统-页边距左偏移_Javascript_Jquery_Css_Wordpress_Disqus - Fatal编程技术网

Javascript Discus注释系统-页边距左偏移

Javascript Discus注释系统-页边距左偏移,javascript,jquery,css,wordpress,disqus,Javascript,Jquery,Css,Wordpress,Disqus,我需要增加家长评论的页边空白(回复评论)。 左边的边距现在是46px、58px等 是否有一些方法可以设置论文左边的页边空白,以抵消评论?通过脚本回答 如果您指的是注释上的注释,则可以使用以下方法,每个父项的偏移量为46+12 $(".comment:not(.changed)").each(function(){ $(this).addClass("changed"); var parents = $(this).parents(".comments"); $(this)

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


是否有一些方法可以设置论文左边的页边空白,以抵消评论?

通过脚本回答

如果您指的是注释上的注释,则可以使用以下方法,每个父项的偏移量为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; }
最佳解决方案

但是最好是嵌套它们,所以您可以只使用
marginleft:12px和嵌套已经移动了12px,现在他的边距也将在那里。所以又移动了一个12px

然后HTML将看起来像:

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

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

我已经做过类似的事情(javascript)。但问题是当我点击“加载更多评论”时。新注释将不会获得偏移量。在添加新注释后,更新了脚本函数,只需调用该方法。它可以工作,但用于分页的discus回调函数(this.callbacks.onPaginate)似乎不起作用。新的评论没有得到任何补偿。我想这是因为它是在html呈现之前调用的。但我不知道如何解决这个问题。以下是我目前的代码:
ul{ margin-left: 12px; }