Scroll to anchor from RJS

Is there an way to tell the browser to scroll to a certain anchor from
an RJS template?

I’m doing a page update, adding stuff at the bottom and want to
browser to go there after it’s been added.

Thanks,
Helzer

On 10/3/07, helzer [email protected] wrote:

Is there an way to tell the browser to scroll to a certain anchor from
an RJS template?

I’m doing a page update, adding stuff at the bottom and want to
browser to go there after it’s been added.

Something like this should work (untested):

render :update do |page|

page[‘myanchor’].scrollTo
end

Which should generate the javascript:

$(‘myanchor’).scrollTo();

HTH

Hi Bob,

It turns out that the effects library is my friend:
page[@dest_id].visual_effect :scroll_to

Thanks,
Amir