简体   繁体   English

跳转到jQuery中完整功能的锚链接?

[英]Jump to an anchor link on function complete in jQuery?

I have a simple slidetoggle function that opens onclick. 我有一个简单的slidetoggle函数,可以打开onclick。 What I'd like to do is jump the user down to the bottom of the page following the opened div. 我想做的是将用户跳到打开的div之后的页面底部。 Basically, wait for the slidetoggle to complete - then imagine clicking my jump link to pull the viewport down. 基本上,等待Slidetoggle完成-然后想象一下单击我的跳转链接将视口拉下。 Here's my code. 这是我的代码。

 $('#clickme').click(function() {
        $('#form-area').slideToggle('slow', function() {
          // Animation complete
                // what can i put here that's like my standard jumpto?

        });
      });

<a href="#form-bottom" id="clickme">Click here</a>

<div class="main" id="form-area" >
 Stuff
</div>
<a name="form-bottom"></a>

这应该工作:

location.href = '#form-bottom';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM