Team:ETH Zurich/tpl/read-more
From 2014.igem.org
(Difference between revisions)
(36 intermediate revisions not shown) | |||
Line 3: | Line 3: | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
- | $(".carousel . | + | var $p, $el, $ps, $up, $r, totalHeight; |
+ | |||
+ | $(".carousel .read-more").click(function() { | ||
totalHeight = 0 | totalHeight = 0 | ||
Line 10: | 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 | ||
.css({ | .css({ | ||
// Set height to prevent instant jumpdown when max height is removed | // Set height to prevent instant jumpdown when max height is removed | ||
- | "height": $ | + | "height": $up.height(), |
"max-height": 999999 | "max-height": 999999 | ||
}) | }) | ||
.animate({ | .animate({ | ||
- | "height": totalHeight | + | "height": totalHeight + 280 |
}); | }); | ||
Line 34: | Line 38: | ||
</script> | </script> | ||
- | + | </html> | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + |
Latest revision as of 18:20, 11 October 2014