我怎样才能使这样的滚动到按钮不导致坐标,而是到特定的 div 或其他东西?
一般来说,有必要在任何屏幕上滚动到反馈表
$(function() {
$('.button').click(function() {
$('body,html').animate({scrollTop:1000},800);
});
});
补充:HTML表单代码
<form id="send-form">
<div class="form-group" style="text-align:left">
<label for="input-name">name</label>
<input type="name" class="form-control" id="input-name" placeholder="HOME COMPLETO" data-toggle="tooltip" title="" required>
<small id="nameHelp" class="form-text text-muted">gfdgdf</small>
</div>
<div class="form-group" style="text-align:left">
<label for="input-phone">phone:</label>
<input type="phone" class="form-control" id="input-phone" value="+39" data-toggle="tooltip" title="+39 XXX XXX XX XX" required>
<small id="phoneHelp" class="form-text text-muted">hgfhf</small>
</div>
</form>
#formId - 您的联系表单选择器
UPD:不知道 scrollTo 通过插件https://github.com/flesler/jquery.scrollTo工作,这里是纯 jquery:
因此您将获得页面任何部分中所需元素的精确坐标。可以通过 setInterval 将当前滚动的 10/20 添加到所需元素来模拟平滑滚动。
或者:
但自己寻求支持。