Team:ETH Zurich/tpl/read-more
From 2014.igem.org
(Difference between revisions)
(51 intermediate revisions not shown) | |||
Line 2: | Line 2: | ||
<script> | <script> | ||
- | $(".carousel .read-more | + | $(document).ready(function(){ |
+ | var $p, $el, $ps, $up, $r, totalHeight; | ||
+ | |||
+ | $(".carousel .read-more").click(function() { | ||
totalHeight = 0 | totalHeight = 0 | ||
Line 9: | Line 12: | ||
$p = $el.parent(); | $p = $el.parent(); | ||
$up = $p.parent(); | $up = $p.parent(); | ||
- | $ps = $up. | + | $ps = $up.children(); |
- | |||
$ps.each(function() { | $ps.each(function() { | ||
totalHeight += $(this).outerHeight(); | totalHeight += $(this).outerHeight(); | ||
}); | }); | ||
+ | |||
+ | totalHeight -= $p.height(); | ||
$up | $up | ||
Line 20: | Line 24: | ||
// Set height to prevent instant jumpdown when max height is removed | // Set height to prevent instant jumpdown when max height is removed | ||
"height": $up.height(), | "height": $up.height(), | ||
- | "max-height": | + | "max-height": 999999 |
}) | }) | ||
.animate({ | .animate({ | ||
- | "height": totalHeight | + | "height": totalHeight + 280 |
}); | }); | ||
- | |||
$p.fadeOut(); | $p.fadeOut(); | ||
- | |||
return false; | return false; | ||
- | + | }); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
}); | }); | ||
+ | |||
+ | |||
</script> | </script> | ||
- | + | </html> | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + |
Latest revision as of 18:20, 11 October 2014