views:

37

answers:

1

I have a simple slidetoggle function that opens onclick. What I'd like to do is jump the user down to the bottom of the page following the opened div. Basically, wait for the slidetoggle to complete - then imagine clicking my jump link to pull the viewport down. 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>
A: 

This should work:

location.href = '#form-bottom';
Shawn Steward
That works - thanks much! Is there a good way to animate smoothly to that position?
nick92675
try the scrollto plugin (http://plugins.jquery.com/project/ScrollTo)Very nice and easy to implement
Raja
Yep what Raja said ^^
Shawn Steward
The requirement changed slightly, so I didn't try the scrollto. But I found in IE6, location.href forced a page refresh. As a quick fix - I just added this to jump to the bottom:dh=document.body.scrollHeight ch=document.body.clientHeight if(dh>ch){ moveme=dh-ch window.scrollTo(0,moveme) }
nick92675