http://eusville.com/eusVote/1/baltimore-sushi
请点击"添加评论/评分"按钮。当评论框下滑时,页面会抖动。非常困惑。在谷歌上搜索了一下,但找不到解决方法。
奇怪的是,问题出现在Chrome和Firefox中。IE却运行顺畅...
HTML div代码如下:...很抱歉,这里有很多razor相关内容,请忽略“@”符号...
jQuery用于上下滑动该Div。
非常感谢您的帮助!TIA。
$(".buttonAddCommentRate").click(function () {
var crBox = $(this).closest('.answer-container').find('.answer-commentRateBox');
var buttonText = $(this).text();
if (buttonText == 'Add comment/rate') {
crBox.slideDown(300);
$(this).text('Cancel comment/rate');
}
else {
crBox.slideUp(300);
$(this).text('Add comment/rate');
}
});
.answer-comment{
width:600px;
float: left;
}
.answer-textArea{
width: 500px;
height: 180px;
}
.answer-commentRateBox{
display:none;
overflow: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="answer-container">
<div class="answer-main">
<h4>@Model.ElementAt(i).Title</h4>
@Model.ElementAt(i).Detail<br /><br />
<button class="buttonAddCommentRate" data-id="@Model.ElementAt(i).AnswerID">Add comment/rate</button>
<span class="span-buttonAddCommentRate">Log in to comment and/or rate</span>
</div>
<div class="answer-eusScore">
eusScore (<span class="answer-count">@Model.ElementAt(i).Count</span>)<br /><br />
<span class="span-answer-eusScore">@(Math.Round((decimal)(Model.ElementAt(i).RatingScore)))%</span>
</div>
<div class="answer-thankYou">
Rating/comment posted
</div>
<br style="clear:both" />
<div class="answer-commentRateBox">
<br />
<div class="answer-comment">
<textarea class="answer-textArea" placeholder="Comment must be more than 5 words ..."></textarea>
</div>
<div class="answer-rateIt">
<input data-id="@Model.ElementAt(i).AnswerID" type="number" class="rating" min=0 max=5 step=0.5 data-size="sm"><br />
<br /><br />
<button class="buttonSubmit" disabled data-id="@Model.ElementAt(i).AnswerID">Submit</button> <button class="buttonCancel">Cancel</button><br />
<span id="span-enable-message" style="font-size:smaller">(rate to enable)</span>
</div>
<br style="clear:both" />
</div>
<div>
@*displays the comments using a partial view*@
@{Html.RenderAction("Comments", "Topic", new { answerID = @Model.ElementAt(i).AnswerID });}
</div>
</div>
<hr />
overflow:hidden
,并在上滑后更改为overflow:auto
。 - Amit Soni