jQuery滚动到元素 - jQuery scroll to element

问题:

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. 而后,我还有其余一些元素,例如其余文本输入,文本区域等。 ui

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. 它应该是滚动到底部而不是顶部。 this

The last item of the page is a submit button with #submit : 页面的最后一项是带有#submitsubmit按钮: spa

<input type="submit" class="submit" id="submit" name="submit" value="Ok, Done.">

The animation should not be too fast and should be fluid. 动画不该太快且应流畅。 .net

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
相关文章
相关标签/搜索