http://eusville.com/eusVote/1/baltimore-sushi
点击“添加评论/费率”按钮。当注释框向下滑动时,页面会摆动。我很沮丧。围绕Google搜索,但找不到解决方案。
奇怪的是问题出在Chrome和Firefox中。IE浏览器工作顺利...
HTML div是:...对不起,那里有很多剃须刀。只是忽略@s ...
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 />
您遇到的问题是由于页面的高度大于视口而导致的。这意味着将出现一个滚动条。
将此添加到您的CSS中,可能会解决您的问题
html {
overflow-y: scroll;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句