问题:
I have this input
element: 我有这个input
元素:
<input type="text" class="textfield" value="" id="subject" name="subject">
Then I have some other elements, like other text inputs, textareas, etc. 然后,我还有其他一些元素,例如其他文本输入,文本区域等。
When the user clicks on that input
with #subject
, the page should scroll to the last element of the page with a nice animation. 当用户使用#subject
单击该input
时,页面应滚动到页面上具有精美动画的最后一个元素。 It should be a scroll to bottom and not to top. 它应该是滚动到底部而不是顶部。
The last item of the page is a submit
button with #submit
: 页面的最后一项是带有#submit
的submit
按钮:
<input type="submit" class="submit" id="submit" name="submit" value="Ok, Done.">
The animation should not be too fast and should be fluid. 动画不应太快且应流畅。
I am running the latest jQuery version. 我正在运行最新的jQuery版本。 I prefer to not install any plugin but to use the default jQuery features to achieve this. 我更喜欢不安装任何插件,而是使用默认的jQuery功能来实现此目的。
解决方案:
参考一: https://stackoom.com/question/S107/jQuery滚动到元素参考二: https://oldbug.net/q/S107/jQuery-scroll-to-element
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/3212995