-
-
Save msmorgan/2511337 to your computer and use it in GitHub Desktop.
This is what I've done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
var micropostIds = [<%= @microposts.map {|micropost| micropost.id }.join(',') %>]; | |
$.each(micropostIds, function (index, value) { | |
$(".slidingDiv" + value).hide(); | |
$(".show_hide" + value).show().click(function () { | |
$(".slidingDiv" + value).slideToggle(); | |
}); | |
}); | |
}); | |
</script> | |
<% for micropost in @microposts %> | |
<%= link_to image_tag('Comment.png', :mouseover => "Comment-Over.png", :class => "show_hide"), "#" %> | |
<div class="slidingDiv<%= micropost.id %>"> | |
<%= render :partial => 'microposts/display', :locals => { :micropost => @micropost } %> | |
</div> | |
<a href="#" class="show_hide<%= micropost.id %>">hide</a> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment