# Smooth scrolling with RJS -\> error

**URL:** <https://www.ruby-forum.com/t/smooth-scrolling-with-rjs-error/188481>\
**Category:** Rails\
**Created:** [May 12, 2010, 5:58pm UTC](https://www.ruby-forum.com/t/smooth-scrolling-with-rjs-error/188481 "2010-05-12T17:58:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [May 12, 2010, 5:58pm UTC](https://www.ruby-forum.com/t/smooth-scrolling-with-rjs-error/188481/1 "2010-05-12T17:58:58Z")

</div>

Hi there,

can anybody tell me what’s wrong with this controller part…?

render :update do |page|  
page.call “jQuery(‘html,body’).animate({  
scrollTop:jQuery(’#top’).offset().top}, 2000)”  
end

The error I get is…

"RJS error:

TypeError: jQuery(“html,body”).animate({  
scrollTop:jQuery("#top").offset().top}, 2000) is not a  
function"

The idea is to have the controller “smooth scroll” to the DIV with the  
ID ‘top’ (which would contain the error message).

(Nothing else besides the jQuery core is needed with this code.)

Thanks for any help!  
Tom
