Team:ETH Zurich/tpl/read-more

From 2014.igem.org

(Difference between revisions)
Line 1: Line 1:
<html>
<html>
<script>
<script>
-
$(document).ready(function(){
+
 
-
  $("#hidesum").click(function(){
+
$(".carousel .button").click(function() {
-
    $(".summary").hide();
+
-
  });
+
totalHeight = 0
-
  $("#showsum").click(function(){
+
 
-
    $(".summary").show();
+
$el = $(this);
-
  });
+
$p  = $el.parent();
 +
$up = $p.parent();
 +
$ps = $up.find("p:not('.read-more')");
 +
 +
// measure how tall inside should be by adding together heights of all inside paragraphs (except read-more paragraph)
 +
$ps.each(function() {
 +
totalHeight += $(this).outerHeight();
 +
});
 +
 +
$up
 +
.css({
 +
// Set height to prevent instant jumpdown when max height is removed
 +
"height": $up.height(),
 +
"max-height": 9999
 +
})
 +
.animate({
 +
"height": totalHeight
 +
});
 +
 +
// fade out read-more
 +
$p.fadeOut();
 +
 +
// prevent jump-down
 +
return false;
 +
});
});
$(document).ready(function(){
$(document).ready(function(){

Revision as of 14:55, 14 August 2014