Compatibility with jQuery 2.x

Changed collapsing procedure causing problems with jQuery 2.x