Can we use a different variable name instead of opacity for the toggling state, and perhaps have an array with 'opacity: 0' and 'opacity: 1'

This way, it is simple to change the test for other properties.