# HG changeset patch # User Bob Farrell # Date 1312043754 -3600 # Branch single-column-redesign-1 # Node ID 071e1f2636a1c7293c13888e5242805a9f7d0d99 # Parent 0322d7bc0a612bf1d59ce8c212cbc3e2b4adbc25 make artist description box expand/collapse with an animation diff -r 0322d7bc0a612bf1d59ce8c212cbc3e2b4adbc25 -r 071e1f2636a1c7293c13888e5242805a9f7d0d99 soundbush/public/js/main.js --- a/soundbush/public/js/main.js Sat Jul 30 01:28:26 2011 +0100 +++ b/soundbush/public/js/main.js Sat Jul 30 17:35:54 2011 +0100 @@ -306,12 +306,15 @@ $("#read-more").toggle( function () { - $("#artist-description").css("max-height", "none"); + // Animating max-height to "none" doesn't work so we need an exact + // value. + var height = $("#artist-description").get(0).scrollHeight; + $("#artist-description").animate({"max-height": height}, 100); $(this).text("Show less"); return false; }, function () { - $("#artist-description").css("max-height", "100px"); + $("#artist-description").animate({"max-height": "100px"}, 100); $(this).text("Show more"); return false; });