Team:ETH Zurich/tpl/read-more
From 2014.igem.org
(Difference between revisions)
(61 intermediate revisions not shown) | |||
Line 3: | Line 3: | ||
$(document).ready(function(){ | $(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> | </script> | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
</html> | </html> |
Latest revision as of 18:20, 11 October 2014