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