page.VisualEffect in rails 3 with jquery
I am trying to migrate to rails 3 and UJS with jquery
Now my old code is like this:
page['contact_detail_data'].visual_effect :scrollTo,:duration => 0.5,:offset => -30
Now in jquery I think I must use animate
so I thought of :
page['contact_detail_data'].animate :scrollTo,:duration => 0.5,:offset => -30
开发者_如何学PythonBut I am unsure of how to give parameters can someone please guide me ?
you can use something like this :
page.call("anim_up_down","certification_#{params[:index]}",30,500 )
And in javascript
function anim_up_down(ele,extraoffset,duration){
$('html,body').animate({scrollTop: $('#'+ele).offset().top-extraoffset},duration)
}
精彩评论