DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Display Images In Separate Div On Mouseover Of List Entry

03.28.2006
| 6759 views |
  • submit to reddit
        Exerpt of prog to handle images from 35mm film. Main admin page displays a table of films. On mouseover of each row  thumbnails of the pictures in that film are displayed in a separate div. 
 
Exerpt of list.rhtml 
<tr id="tablerow<%= roll.id %> " onMouseover="<%= remote_function(:update => "preview",  :url => { :action => :preview ,  :id => roll.id})%>;">

Exerpt of controller.rb
  def preview
    @pictures = Picture.find(:all, :conditions => ["roll_id = #{params[:id]} "])
    render(:partial => "preview")
  end

_preview.rhtml 
<% for picture in @pictures%>
<img src= <%= picture.thumb_url %> alt= <%= picture.thumb_url %> height=60 >
<% end %>
    

Comments

Snippets Manager replied on Thu, 2010/05/06 - 1:43pm

Hello I would like to do the same using Low Pro ( http://github.com/danwrong/low-pro ) But I can't because my list is in a partial and is not loaded when you load the page but after clicking some button. So the javascript doesn't applies to the concerned div in the partial... Have any idea of a way to solve that problem? Thanks