jquery/ ruby on rails - changing the height of a div dynamically -


in app have page user can see reviews listed 1 under other. each review has 'edit' link:

<div id ="edit_link">     <%= link_to i18n.t('user.review.edit.edit'), edit_review_path(review), :remote => true, :class => "edit_review_link" %>     </div> 

it loads editable review on same page other reviews, , user can change it.

it loads code in edit.js.erb file:

$('#review_<%=@review.id%>').html("<%= escape_javascript(render 'edit') %>") 

now i'm trying change height of review editing when loads. ideas how this?

i did try in edit.js.erb file:

$('#review_<%=@review.id%>').html("<%= escape_javascript(render 'edit') %>")  $('#review_<%= review.id %>').animate({height:'250px'}, 350); //this method increases height 250px, @ .35 seconds 

but 500 (internal server error) error.

i did try this, pasting within _review.html.erb file:

<script> $('#edit_link').click(function(){     $('#review_<%= review.id %>').animate({height:'250px'}, 350);     //this method increases height 250px, speed of .35 seconds }); </script> 

but toggles on first review, @ top of list. also, increases size of reviews below. help.

you have typo error, missing @ sign before variable ;)

change this:

$('#review_<%= review.id %>').animate({height:'250px'}, 350); 

to this:

$('#review_<%= @review.id %>').animate({height:'250px'}, 350);                ^                # here, add '@' 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -