feature(js): extended the usability of rel="toggle"

came up with a feature to allow more control over rel="toggle".

This helps for #7508, reduces the need for #5139 and fixes #3070
Need space after `if`. Otherwise I'm cool with this.