nan*_*erd 5 html css jquery toggle razor
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');
}
});Run Code Online (Sandbox Code Playgroud)
.answer-comment{
width:600px;
float: left;
}
.answer-textArea{
width: 500px;
height: 180px;
}
.answer-commentRateBox{
display:none;
overflow: hidden;
}Run Code Online (Sandbox Code Playgroud)
<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 />Run Code Online (Sandbox Code Playgroud)
小智 4
您遇到的问题是由于页面的高度大于视口而发生的。这意味着将出现一个滚动条。
将其添加到您的 css 中,它可能会解决您的问题
html {
overflow-y: scroll;
}
Run Code Online (Sandbox Code Playgroud)