calculate height of templates and resize when showing/hiding