@Megalomaniac awesome function. I think I'm having a different issue than @ivy2015 but the solution is probably the same. I can't use "show more" or "show less" because I need the button to be understood by different languages. So I've changed the button phrases "show more" and "show less" in to appropriate fontawesome icons that allows any language to understand what to expect when they click the button. Which works fine!
However, when I collapse the content again to hide the blocks, the icons I've added revert back to Show More and Show Less.
I updated the header code in a way that (to me at least) means it should work. And to be fair it does work - but just once. As soon as I collapse the button my button styling reverts back to your original.